The script shows the way to capture the key press event by a GTK3 window.
- Define a
key-press-event
handler named self.keyCapture
in a window.
- Key press of normal keys as well as special keys can be detected.
- The
event.keyval
in the event handler returns the key value of the pressed key. This value relates to a unique key name returned by Gtk.keyval_name().
- In addition,
Gtk.accelerator_get_label()
also returns a unique label describing the state (whether Shift, Alt or Ctrl is added) of the pressed key.
Source Code
No comments:
Post a Comment