Key¶
The Key
event is sent to a widget when the user presses a key on the keyboard.
- Bubbles
- Verbose
Attributes¶
attribute | type | purpose |
---|---|---|
key |
str | Name of the key that was pressed. |
char |
str or None | The character that was pressed, or None it isn't printable. |
Code¶
textual.events.Key
class
¶
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 |
required |
Attributes
Name | Type | Description |
---|---|---|
aliases |
list[str]
|
The aliases for the key, including the key itself. |