:right-sidebar: True KeyEvent =================================================================== .. currentmodule:: gi.repository.Gdk .. class:: KeyEvent(*args, **kwargs) :no-contents-entry: Superclasses: :class:`~gi.repository.Gdk.Event` An event related to a key-based device. Methods ------- .. rst-class:: interim-class .. class:: KeyEvent :no-index: .. method:: get_consumed_modifiers() -> ~gi.repository.Gdk.ModifierType Extracts the consumed modifiers from a key event. .. method:: get_keycode() -> int Extracts the keycode from a key event. .. method:: get_keyval() -> int Extracts the keyval from a key event. .. method:: get_layout() -> int Extracts the layout from a key event. .. method:: get_level() -> int Extracts the shift level from a key event. .. method:: get_match() -> ~typing.Tuple[bool, int, ~gi.repository.Gdk.ModifierType] Gets a keyval and modifier combination that will match the event. See :obj:`~gi.repository.Gdk.KeyEvent.matches`\. .. method:: is_modifier() -> bool Extracts whether the key event is for a modifier key. .. method:: matches(keyval: int, modifiers: ~gi.repository.Gdk.ModifierType) -> ~gi.repository.Gdk.KeyMatch Matches a key event against a keyval and modifiers. This is typically used to trigger keyboard shortcuts such as Ctrl-C. Partial matches are possible where the combination matches if the currently active group is ignored. Note that we ignore Caps Lock for matching. :param keyval: the keyval to match :param modifiers: the modifiers to match