[pygtk] hotkey support?
Tom Roche
Tom_Roche at pobox.com
Tue Mar 30 09:36:14 WST 2010
Apologies if this is a FAQ, but I haven't seen anything in the FAQ,
wiki, or references (or even googling) regarding this: how to support
hotkeys (or registered global key bindings) with PyGTK? What I mean:
I'd like for data from a barcode scanner to go to a particular file or
process, not just to whatever is consuming stdin. (For more details
about the usecase, see the thread starting @
http://mail.python.org/pipermail/tutor/2010-March/075438.html
) One suggestion is to prefix an Alt-keychord, Ctrl-keychord, or
function key to the scanner output, and to register the prefixed key
as a hotkey. I know the particular barcode scanner I'm using claims to
support a wide variety of prefix keys (per the PDF
http://tinyurl.com/waspWLS9500manual
pages 147-148, 169-170, 174-175, 177-178), and google led me to
http://kaizer.se/wiki/python-keybinder
> a python module for gtk-based applications registering global key
> bindings. [...] This package has taken the python bindings for
> Tomboy's keybinder from the Deskbar Applet project, and broken it
> out to be a standalone module.
However I haven't seen anything explaining (preferably at a newbie
level) how to configure a PyGTK app to listen for and consume a
registered hotkey. I did find a recent post to this list
http://www.daa.com.au/pipermail/pygtk/2009-April/016972.html
> Is it possible to install a global keyboard shortcut, so if the user
> presses Ctrl-Alt-X anywhere, and my pygtk application is running, my
> application would get an event?
but no replies to it. Can anyone show/tell me how to handle hotkeys in
PyGTK?
TIA, Tom Roche <Tom_Roche at pobox.com>
More information about the pygtk
mailing list