Sunday, 22 May 2022

Key Press Event Handler

The script shows the way to capture the key press event by a GTK3 window.


  1. Define a key-press-event handler named self.keyCapture in a window.
  2. Key press of normal keys as well as special keys can be detected.
  3. 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().
  4. 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