[Tutor] Problem in scalling............
perl lover
hemanexp@yahoo.com
Tue Apr 29 20:15:06 2003
hi,
i have a problem in scalling a canvas widget in
tkinter. I have created a canvas of size 1000 * 1000.
When i move the mouse over canvas the x,y values of
mouse pointer are showned in status bar. It is working
fine with normal canvas(ie, before scalling). I got
762*477 as bottom right pixel value. When i scallled
the canvas stil i got the same value (762*477) if the
mouse is placed at bottom right of the canvas. Since i
used 2 as scalling factor for both x,y, I expect
bottom right value is as half as normal canvas (ie,
381,248). How can i get it? My program is given below.
from Tkinter import *
class App:
def __init__(self,parent):
self.myparent = parent
self.canvas =
Canvas(parent,width="1000m",height="1000m")
self.canvas.create_rectangle(100,100,200,200,fill='blue')
self.canvas.bind('<B1-ButtonRelease>',self.ZoomIn)
self.canvas.bind('<Motion>',self.mm)
self.canvas.pack()
def ZoomIn(self,event):
self.canvas.scale(ALL,2,2,1.5,1.5)
def mm(self,event):
print
self.canvas.canvasx(event.x),self.canvas.canvasy(event.y)
root = Tk()
myapp = App(root)
root.mainloop()
Thanx
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com