[pygtk] a method connected to 'motion_notify_event' not working

L AMEE l04m33 at gmail.com
Sat May 5 01:05:41 WST 2007


I intended to make something that concerns the motion of the mouse pointer.
And in the program I worked around with the 'motion_notify_event' thing, but
the program and all my testing scripts for this issue failed to do what I
expected, including the one below

#############################################
# ttt.py

import pygtk
pygtk.require('2.0')
import gtk

class TTT:
    def __init__(self):
        self.mw =3D gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.mw.connect('delete_event', gtk.main_quit)
        self.mw.connect('motion_notify_event', self.motion_notify_event)
        self.mw.show()

    def motion_notify_event(self, widget, event):
        print event    # This should print something

    def run(self):
        gtk.main()


if __name__ =3D=3D '__main__':
    tt =3D TTT()
    tt.run()
################################################

I expected something be printed out when I move the mouse within the main
window, but the result is that no printing ever happened.

Is there anything wrong with my script? Something else I should set up?....
Thanks in advance : )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20070505/23787aa1/at=
tachment.htm


More information about the pygtk mailing list