[Tkinter-discuss] Tkinter-discuss Digest, Vol 45, Issue 2
michael.odonnell at uam.es
Sun Nov 18 17:34:38 CET 2007
> canvas.bind('<Button-1>', func1)
> canvas.bind('<B1-Motion>', func2)
> canvas.bind('<ButtonRelease-1>', func3)
> Currently I can print the variables, but is there any way to actually return
> the x,y coordinates of the mouse and store them in a variable? This is part
> of a larger photo editor project, but in general I want to be able to watch
> for mouse clicks and return position values... any idea as to how?
func1, func2 and func3 are called with one argument, which is
an event object.
You can then access event.x and event.y
print event.x, event.y
More information about the Tkinter-discuss