[Tkinter-discuss] Tkinter.bind(), watching for mouse click and release inside a canvas

aonomus n.chu at utoronto.ca
Sat Nov 17 19:19:02 CET 2007


My goal is to write a clip of code so that a user can click inside a canvas,
drag and release to make a crop box of his size, then crop. So after looking
around at pages like
http://www.pythonware.com/library/tkinter/introduction/events-and-bindings.htm,
I figure I can:

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?
-- 
View this message in context: http://www.nabble.com/Tkinter.bind%28%29%2C-watching-for-mouse-click-and-release-inside-a-canvas-tf4827513.html#a13811890
Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.



More information about the Tkinter-discuss mailing list