Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/key_values.py
blob: 8e748fa3a5bddac060eb65f907f81086bacf8a77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from gi.repository import Gtk
from gi.repository import Gdk

def _destroy_cb(widget, data=None):
    Gtk.main_quit()


def event_cb(widget, event):
    print Gdk.keyval_name(event.keyval)

window = Gtk.Window()
window.connect("destroy", _destroy_cb)

box = Gtk.EventBox()

box.set_events(Gdk.EventMask.KEY_PRESS_MASK)

box.connect('key_press_event', event_cb)
window.add(box)
box.set_can_focus(True)
box.grab_focus()


window.show_all()
Gtk.main()