File: example.py

package info (click to toggle)
keybinder 0.3.1-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 1,880 kB
  • sloc: sh: 11,397; ansic: 602; makefile: 151; 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()