pygfx.objects.Event
- class pygfx.objects.Event(type: str | EventType, *, bubbles=True, target: EventTarget = None, root: RootEventHandler = None, time_stamp: float = None, cancelled: bool = False, event_type: str = None)
Bases:
object
Event base class.
If a target is set, an event can bubble up through a hierarchy of targets, connected through a
parent
property. To prevent an event from bubbling up, usestop_propagation
.It is also possible to cancel events, which will stop any further handling of the event (also by the same target).
- Parameters:
type (Union[str, EventType]) – The name of the event.
bubbles (bool) – If True, the event bubbles up through the scene tree.
target (EventTarget) – The object onto which the event was dispatched.
root (RootEventHandler) – A reference to the root event handler.
time_stamp (float) – The time at which the event was created (in seconds). Might not be an actual time stamp so please only use this for relative time measurements.
cancelled (bool) – A boolean value indicating whether the event is cancelled.
event_type (str) – Unused.
- property type: str
A string representing the name of the event.
- property root: RootEventHandler
A reference to the root event handler.
- property time_stamp: float
The time at which the event was created (in seconds). Might not be an actual time stamp so please only use this for relative time measurements.
- property bubbles: bool
A boolean value indicating whether or not the event bubbles up through the scene tree.
- property target: EventTarget
The object onto which the event was dispatched.
- property current_target: EventTarget
The object that is currently handling the event. During event bubbling this property will be updated whenever an event bubbles up in the hierarchy.
- property cancelled: bool
A boolean value indicating whether the event is cancelled.
- stop_propagation()
Stops propagation of events further along in the scene tree.
- cancel()
Cancels the event and stops propagation.