Tk events

John Grayson johngrayson at home.com
Wed May 31 13:12:41 EDT 2000


In article <3933F9C6.F67412D8 at mitre.org>,
  Peter Leveille <psl at mitre.org> wrote:
> Does anyone know what the event name is for catching mouse movement
> without a button pressed?  Grayson's book "Python and Tkinter
> Programming" mentions a PointerMotionMask for the Motion event,  but I
> can't find any more info on that mask.
>

Peter,

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()

   John


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list