faqts : Computers : Programming : Languages : Python : Tkinter : Events

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 6 people (100%) answered Yes
Recently 4 of 4 people (100%) answered Yes

Entry

What's the event name for catching mouse movement without a button pressed?

Jun 1st, 2000 07:38
unknown unknown, John Grayson


From John Grayson's book "Python and Tkinter Programming"

I think Example_6_2.py demostrates this, and the event is also noted on 
page 618.

However, this snippet tracks the motion of the mouse without a button 
down...

from Tkinter import *

root = Tk()

def motion(event):
    print 'Mouse: x=%d, y=%d' % (event.x, event.y)

frame = Frame(root, width=250, height=250)
frame.bind('<Motion>', motion)
frame.pack()

root.mainloop()