[pygtk] Receive events without focus

Robert Schroll rschroll at gmail.com
Sat Jun 1 03:30:53 WST 2013


On 05/31/2013 04:44 AM, Thomas Guettler wrote:
> I write a native GUI with gtk, which needs to receive keyboard events
> although the window does not have the focus.

You might want to take a look at programs that show keypresses for use 
in screencasts and demonstrations, since these have to notice keypresses 
without having focus.  A few years back, I toyed with key-mon 
(http://code.google.com/p/key-mon/), a pygtk program that does this on 
linux.  While googling for this, I stumbled across pykeyview 
(https://github.com/mattharrison/pykeyview).  I haven't tried this, but 
it looks a lot more basic, which might make it easier to figure out.

It looks like both get the keypress events from X, so you'd presumably 
need another solution for windows.

Hope that helps,
Robert



More information about the pygtk mailing list