InputEventKey¶
Inherits: InputEventWithModifiers < InputEventFromWindow < InputEvent < Resource < RefCounted < Object
Input event type for keyboard events.
Description¶
Stores key presses on the keyboard. Supports key presses, key releases and echo events.
Tutorials¶
Properties¶
|
||
|
||
|
||
|
||
|
Methods¶
get_keycode_with_modifiers ( ) const |
|
get_physical_keycode_with_modifiers ( ) const |
Property Descriptions¶
bool echo
Default |
|
Setter |
set_echo(value) |
Getter |
is_echo() |
If true
, the key was already pressed before this event. It means the user is holding the key down.
Key keycode
Default |
|
Setter |
set_keycode(value) |
Getter |
get_keycode() |
The key keycode, which corresponds to one of the Key constants. Represent key in the current keyboard layout.
To get a human-readable representation of the InputEventKey
, use OS.get_keycode_string(event.keycode)
where event
is the InputEventKey
.
Key physical_keycode
Default |
|
Setter |
set_physical_keycode(value) |
Getter |
get_physical_keycode() |
Key physical keycode, which corresponds to one of the Key constants. Represent the physical location of a key on the 101/102-key US QWERTY keyboard.
To get a human-readable representation of the InputEventKey
, use OS.get_keycode_string(event.keycode)
where event
is the InputEventKey
.
bool pressed
Default |
|
Setter |
set_pressed(value) |
Getter |
is_pressed() |
If true
, the key's state is pressed. If false
, the key's state is released.
int unicode
Default |
|
Setter |
set_unicode(value) |
Getter |
get_unicode() |
The key Unicode identifier (when relevant). Unicode identifiers for the composite characters and complex scripts may not be available unless IME input mode is active. See Window.set_ime_active for more information.
Method Descriptions¶
Key get_keycode_with_modifiers ( ) const
Returns the keycode combined with modifier keys such as Shift or Alt. See also InputEventWithModifiers.
To get a human-readable representation of the InputEventKey
with modifiers, use OS.get_keycode_string(event.get_keycode_with_modifiers())
where event
is the InputEventKey
.
Key get_physical_keycode_with_modifiers ( ) const
Returns the physical keycode combined with modifier keys such as Shift or Alt. See also InputEventWithModifiers.
To get a human-readable representation of the InputEventKey
with modifiers, use OS.get_keycode_string(event.get_physical_keycode_with_modifiers())
where event
is the InputEventKey
.