Gdk.KeyEvent

g Gdk.Event Gdk.Event Gdk.KeyEvent Gdk.KeyEvent Gdk.Event->Gdk.KeyEvent

Subclasses:

None

Methods

Inherited:

Gdk.Event (17)

get_consumed_modifiers ()

get_keycode ()

get_keyval ()

get_layout ()

get_level ()

get_match ()

is_modifier ()

matches (keyval, modifiers)

Virtual Methods

None

Fields

None

Class Details

class Gdk.KeyEvent
Bases:

Gdk.Event

Abstract:

No

An event related to a key-based device.

get_consumed_modifiers()[source]
Returns:

the consumed modifiers or self

Return type:

Gdk.ModifierType

Extracts the consumed modifiers from a key event.

get_keycode()[source]
Returns:

the keycode of self

Return type:

int

Extracts the keycode from a key event.

get_keyval()[source]
Returns:

the keyval of self

Return type:

int

Extracts the keyval from a key event.

get_layout()[source]
Returns:

the layout of self

Return type:

int

Extracts the layout from a key event.

get_level()[source]
Returns:

the shift level of self

Return type:

int

Extracts the shift level from a key event.

get_match()[source]
Returns:

True on success

keyval:

return location for a keyval

modifiers:

return location for modifiers

Return type:

(bool, keyval: int, modifiers: Gdk.ModifierType)

Gets a keyval and modifier combination that will match the event.

See [method`Gdk`.KeyEvent.matches].

is_modifier()[source]
Returns:

True if the self is for a modifier key

Return type:

bool

Extracts whether the key event is for a modifier key.

matches(keyval, modifiers)[source]
Parameters:
Returns:

a GdkKeyMatch value describing whether self matches

Return type:

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.