KeyboardEvent
Overview
KeyboardEvent is a class in Aspose.Html FOSS for Python.
Inherits from: UIEvent.
Keyboard event (WHATWG UI Events §5.3).
This class provides 5 methods for working with KeyboardEvent objects in Python programs.
Available methods include: __init__, init_event, prevent_default, stop_immediate_propagation, stop_propagation.
All public members are accessible to any Python application after installing the Aspose.Html FOSS for Python package.
Properties: DOM_KEY_LOCATION_LEFT, DOM_KEY_LOCATION_NUMPAD, DOM_KEY_LOCATION_RIGHT, DOM_KEY_LOCATION_STANDARD, alt_key, bubbles, and 17 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
key | str | Read | Key value string (e.g. |
code | str | Read | Physical key code string (e.g. |
location | int | Read | Key location (standard, left, right, or numpad). |
repeat | bool | Read | True when the key is held down and the event is auto-repeated. |
is_composing | bool | Read | True when the event is fired within an active IME composition. |
alt_key | bool | Read | Whether the Alt key was active when the event fired. |
ctrl_key | bool | Read | Whether the Ctrl key was active when the event fired. |
meta_key | bool | Read | Whether the Meta key was active when the event fired. |
shift_key | bool | Read | Whether the Shift key was active when the event fired. |
DOM_KEY_LOCATION_STANDARD | int | Read | Gets the dom key location standard. |
DOM_KEY_LOCATION_LEFT | int | Read | Gets the dom key location left. |
DOM_KEY_LOCATION_RIGHT | int | Read | Gets the dom key location right. |
DOM_KEY_LOCATION_NUMPAD | int | Read | Gets the dom key location numpad. |
detail | int | Read | Integer detail value associated with the event. |
view | None | Read | Always None in headless mode (Window back-reference out of scope). |
type | str | Read | The event type string. |
bubbles | bool | Read | Whether the event bubbles. |
cancelable | bool | Read | Whether the default action can be prevented. |
target | "EventTarget | None" | Read | The EventTarget on which the event was dispatched. |
current_target | "EventTarget | None" | Read | The EventTarget whose listener is currently being invoked. |
event_phase | int | Read | Phase constant: NONE (0), CAPTURING_PHASE (1), AT_TARGET (2), BUBBLING_PHASE (3). |
default_prevented | bool | Read | Whether preventDefault() was called on a cancelable event. |
timestamp | float | Read | Unix epoch time (seconds) at Event creation. |
Methods
| Signature | Description |
|---|---|
__init__(type: str, bubbles: bool, cancelable: bool, detail: int, key: str, code: str, location: int, repeat: bool, is_composing: bool, alt_key: bool, ctrl_key: bool, meta_key: bool, shift_key: bool) | Calls init(type, bubbles, cancelable, detail, key, code, location, repeat, is_composing, alt_key, ctrl_key, meta_key, shift_key) on this KeyboardEvent instance. |
prevent_default() | Set default_prevented to True if the event is cancelable. |
stop_propagation() | Stop event propagation after all listeners on the current target finish. |
stop_immediate_propagation() | Stop propagation AND prevent remaining listeners on the current target. |
init_event(type: str, bubbles: bool, cancelable: bool) | Legacy alias for pre-dispatch event initialization. |