[clug] Building a simple UI with pygame, keystrokes and a window focus problem

Francis Whittle fj.whittle at gmail.com
Thu Feb 3 20:45:20 MST 2011


I don't have any experience with pygame, but if you're trying to do this
inside an X11 process, the keyboard focus is generally determined by the
window manager.  X11 clients can theoretically prevent other
applications from getting focus by "grabbing" the input system.  Pygame
supposedly has a facility for this in the event module in the form of
the set_grab method. See
http://www.pygame.org/ctypes/pygame-api/pygame.event-module.html .   I
say theoretically because X11 and/or the WM can prevent it from working
properly.

GStreamer developers would probably tell you to "just write a photobooth
application in python, it's easy"

Regards,
Francis

On Tue, 2011-02-01 at 21:37 +1100, Hal Ashburner wrote:
> So I just want to create a very very simple and stupid UI that responds 
> to keystrokes, on which it makes a noise or launches/kills a process. I 
> want all keystrokes to be handled by this UI and not captured by the any 
> launched process.
> 
> Am I doing it all wrong using pygame? Suggestions with or without pygame?
> 
> Cheers,
> Hal




More information about the linux mailing list