Hello,

I need to follow the mouse motion on a custom created widget. This is
what the official documentation suggests: [0]

"It turns out, however, that there is a problem with just specifying
POINTER_MOTION_MASK. This will cause the server to add a new motion
event to the event queue every time the user moves the mouse. Imagine
that it takes us 0.1 seconds to handle a motion event, but the X server
queues a new motion event every 0.05 seconds. We will soon get way
behind the users drawing. If the user draws for 5 seconds, it will take
us another 5 seconds to catch up after they release the mouse button!
What we would like is to only get one motion event for each event we
process. The way to do this is to specify POINTER_MOTION_HINT_MASK."

I thought "smart!" and went on trying. Unfortunately, even the provided
example [1] doesn't work, as far as I understand: if I change the line
65 from
        x, y, state = event.window.get_pointer()
to
        x, y, state = 1,2,3
(notice that at this point, in all the program not a single call to
"get_pointer" is made), I would expect no more receiving
"motion_notify_event"s... instead by adding a "print" to the handler I
notice they keep flowing...

Moreover, I noticed that on the linux distros I had available (Ubuntu
Hardy and Intrepid, on 2 different computers), a widget example found on
the net ([2]) and mirrored on official pygtk site ([3]) doesn't work
(see my comment on bottom of page); could anyone test it on some other
distro and tell me if it does?

thank you

Pietro Battiston

[0]: http://www.pygtk.org/pygtk2tutorial/sec-EventHandling.html
[1]: http://www.pygtk.org/pygtk2tutorial/examples/scribblesimple.py
[2]:
http://www.learningpython.com/2006/07/25/writing-a-custom-widget-using-pygtk/
[3]:
http://www.pygtk.org/articles/writing-a-custom-widget-using-pygtk/writing-a-custom-widget-using-pygtk.htm

Attachment: signature.asc
Description: Questa รจ una parte del messaggio firmata digitalmente

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to