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

  • key - The key that was pressed down, such as A, ENTER or SHIFT_LEFT.
  • physical_key - The position of the key that was pressed down on the keyboard, such as W, whatever the active layout.

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_keyinstance-attribute​

physical_key: PhysicalKeyboardKey | int

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

A key that has no PhysicalKeyboardKey member is its USB HID usage code.