pygfx.objects.RootEventHandler
- class pygfx.objects.RootEventHandler(*args, **kwargs)
Bases:
EventTarget
Pygfx event handler.
Root event handler for the Pygfx event system.
- dispatch_event(event: Event)
Dispatch the given event.
This method will dispatch an event by looking for the right target to handle the event. When a target is set on the event, then that target will be the first object that gets to handle the event. From there it will ask its parents one-by-one to handle the event as long as the event bubbles / propagates up or is not cancelled.
The RootEventHandler object will serve as a virtual root for the tree hierarchy.
Whenever an object has captured the pointer (for a specific pointer_id) then that object will get all pointer related events until the object releases the capture or a
pointer_up
event is encountered.This method will also keep track of
pointer_down
andpointer_up
events in order to generate and dispatchclick
anddouble_click
events.- Parameters:
event (Event) – The event to dispatch.