Skip to content

Instantly share code, notes, and snippets.

@lesthack
Created October 20, 2011 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lesthack/1302380 to your computer and use it in GitHub Desktop.
Save lesthack/1302380 to your computer and use it in GitHub Desktop.
Sample of Keybinder in python
#!/usr/bin/env python
"""
example.py
Created in 2010 by Ulrik Sverdrup <ulrik.sverdrup@gmail.com>
This work is placed in the public domain.
"""
import gtk
import keybinder
def callback(user_data):
print "Handling", user_data
gtk.main_quit()
if __name__ == '__main__':
keystr = "<Ctrl>A"
keybinder.bind(keystr, callback, "Keystring %s (user data)" % keystr)
print "Press", keystr, "to handle keybinding and quit"
gtk.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment