Help With Button Layout

Norman Davis normandavis at bigfoot.com
Wed Dec 11 21:41:51 EST 2002


Hi Kenneth,

Glad to be of help.

I haven't done any interactive graphics with Tkinter myself, however
I've come across the topic of "bindings and events".  I think you want
to bind to "<Button1-Motion>" events from your canvas. That way you'll
get regular updates about the position of the mouse while the mouse's
button1 is pressed and the pointer is in the canvas area. (You need to
also bind to the press and release events for button1 to know when the
press starts and stops; maybe there's others you need to use too.)

You might take a look at:

Chapter 7 of An Introduction to Tkinter by Fredrik Lundh:
http://www.pythonware.com/library/an-introduction-to-tkinter.htm

Section 22 of Tkinter reference:
http://www.nmt.edu/tcc/help/pubs/lang.html

Section 16.1.6.7 of the Python Library Reference : 
http://www.python.org/doc/current/lib/node521.html

I'm not sure if those together are complete enough to get you going
for this particular topic. I'm using the book Python and Tkinter
Programming by John E. Grayson, and it seems to cover this fairly
well.

Can anyone reading this recommend a good tkinter application available
on the net that would be a good example for mouse event handling?

Norm.



More information about the Python-list mailing list