MouseEvent

Overview

MouseEvent is a class in Aspose.Html FOSS for Python. Inherits from: UIEvent.

Mouse or pointer event (WHATWG UI Events §5.2).

This class provides 5 methods for working with MouseEvent 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: alt_key, bubbles, button, buttons, cancelable, client_x, and 19 more.

Properties

NameTypeAccessDescription
buttonintReadWhich mouse button was pressed (0 = primary, 1 = middle, 2 = secondary).
buttonsintReadBitmask of all currently pressed mouse buttons.
client_xintReadHorizontal coordinate relative to the viewport.
client_yintReadVertical coordinate relative to the viewport.
screen_xintReadHorizontal coordinate relative to the screen.
screen_yintReadVertical coordinate relative to the screen.
offset_xintReadHorizontal offset relative to the target element’s padding edge (always 0).
offset_yintReadVertical offset relative to the target element’s padding edge (always 0).
page_xintReadHorizontal coordinate relative to the document (always 0 in headless mode).
page_yintReadVertical coordinate relative to the document (always 0 in headless mode).
alt_keyboolReadWhether the Alt key was active when the event fired.
ctrl_keyboolReadWhether the Ctrl key was active when the event fired.
meta_keyboolReadWhether the Meta key was active when the event fired.
shift_keyboolReadWhether the Shift key was active when the event fired.
related_target"object | None"ReadSecondary target (e.g.
detailintReadInteger detail value associated with the event.
viewNoneReadAlways None in headless mode (Window back-reference out of scope).
typestrReadThe event type string.
bubblesboolReadWhether the event bubbles.
cancelableboolReadWhether the default action can be prevented.
target"EventTarget | None"ReadThe EventTarget on which the event was dispatched.
current_target"EventTarget | None"ReadThe EventTarget whose listener is currently being invoked.
event_phaseintReadPhase constant: NONE (0), CAPTURING_PHASE (1), AT_TARGET (2), BUBBLING_PHASE (3).
default_preventedboolReadWhether preventDefault() was called on a cancelable event.
timestampfloatReadUnix epoch time (seconds) at Event creation.

Methods

SignatureDescription
__init__(type: str, bubbles: bool, cancelable: bool, detail: int, button: int, buttons: int, client_x: int, client_y: int, screen_x: int, screen_y: int, alt_key: bool, ctrl_key: bool, meta_key: bool, shift_key: bool, related_target: object)Calls init(type, bubbles, cancelable, detail, button, buttons, client_x, client_y, screen_x, screen_y, alt_key, ctrl_key, meta_key, shift_key, related_target) on this MouseEvent 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.

See Also