EventControllerKey#

class EventControllerKey(**properties: Any)#

Superclasses: EventController, Object

GtkEventControllerKey is an event controller that provides access to key events.

Constructors#

class EventControllerKey
classmethod new() EventController#

Creates a new event controller that will handle key events.

Methods#

class EventControllerKey
forward(widget: Widget) bool#

Forwards the current event of this controller to a widget.

This function can only be used in handlers for the key_pressed, key_released or modifiers signals.

Parameters:

widget – a GtkWidget

get_group() int#

Gets the key group of the current event of this controller.

See get_layout.

get_im_context() IMContext | None#

Gets the input method context of the key controller.

set_im_context(im_context: IMContext | None = None) None#

Sets the input method context of the key controller.

Parameters:

im_context – a GtkIMContext

Signals#

class EventControllerKey.signals
im_update() None#

The type of the None singleton.

key_pressed(keyval: int, keycode: int, state: ModifierType) bool#

The type of the None singleton.

Parameters:
  • keyval – the pressed key.

  • keycode – the raw code of the pressed key.

  • state – the bitmask, representing the state of modifier keys and pointer buttons.

key_released(keyval: int, keycode: int, state: ModifierType) None#

The type of the None singleton.

Parameters:
  • keyval – the released key.

  • keycode – the raw code of the released key.

  • state – the bitmask, representing the state of modifier keys and pointer buttons.

modifiers(state: ModifierType) bool#

The type of the None singleton.

Parameters:

state – the bitmask, representing the new state of modifier keys and pointer buttons.