Skip to main content

KeyDownEvent

Event triggered when a key is pressed down.

Typically used to detect the initial press of a key before it is released or repeated.

Inherits: Event

Properties

Properties​

keyinstance-attribute​

key: KeyboardKey | str

The key that was pressed down, such as A, ENTER or SHIFT_LEFT.

A key that has no KeyboardKey member is a plain string, such as "Ü".

physical_keyclass-attributeinstance-attribute​

physical_key: PhysicalKeyboardKey | int | None = None

The position of the key that was pressed down on the keyboard, such as PhysicalKeyboardKey.W, whatever the active layout.

A key that has no PhysicalKeyboardKey member is its USB HID usage code. Older clients that omit the physical key leave this as None.