Skip to content

Bases: InputEvent

Sent when the user hits a key on the keyboard.

  • Bubbles
  • Verbose

Parameters:

Name Type Description Default

key

str

The key that was pressed.

required

character

str | None

A printable character or None if it is not printable.

required

aliases instance-attribute

aliases = _get_key_aliases(key)

The aliases for the key, including the key itself.

character instance-attribute

character = (
    key
    if len(key) == 1
    else None if character is None else character
)

A printable character or None if it is not printable.

is_printable property

is_printable

Check if the key is printable (produces a unicode character).

Returns:

Type Description
bool

True if the key is printable.

key instance-attribute

key = key

The key that was pressed.

name property

name

Name of a key suitable for use as a Python identifier.

name_aliases property

name_aliases

The corresponding name for every alias in aliases list.