Created
October 20, 2011 21:05
-
-
Save lesthack/1302380 to your computer and use it in GitHub Desktop.
Sample of Keybinder in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
example.py | |
Created in 2010 by Ulrik Sverdrup <[email protected]> | |
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