File: example.py

package info (click to toggle)
keybinder 0.2.2-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,488 kB
  • ctags: 158
  • sloc: sh: 10,224; ansic: 520; makefile: 105; python: 10
file content (19 lines) | stat: -rwxr-xr-x 432 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/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()