[pygtk] check button state continuously

A.T.Hofkamp a.t.hofkamp at tue.nl
Mon Oct 2 14:37:45 WST 2006


Karsten Henke wrote:
> So in GTK there is no possibility to check the mouse-button (if it is 
> released). I have to use a lower layer if i want to get the button 
> released event? Can anyone suggest some reading how Events in GTK are 
> created and how the infos (Button pressed and released) are checked?

Under X11 (ie *nix systems), they are not created exactly, they are sent to 
the application by the X11 server (ie the program that manages the hardware 
(mouse, keyboard, large bitmap commonly known as monitor screen).
The latter 'accesses' the mouse using a mouse driver.

To make life slightly more interesting, there is also a window manager. That 
is a user program that manages the focus, title-bars, and background, ie it 
controls where the mouse/keyboard/etc events get sent to.

Maybe under Windows it is a different story, but since GTK is cross platform, 
I'd be surprised if the developers expose a platform-specific facility.


If your robot movement is critical, I'd add a big red emergency 
CUT-THE-POWER-NOW button, it is a lot more safe than the state of a button 
buried somewhere deep in the graphical system.

Albert


More information about the pygtk mailing list