Events
Event
mypygui.core.services.events.event.Event
Event.Types
Event.Types
Enum (static)
Currently supported dom events are
- click
- mouse_up
- enter
- key_press
- key_release
- leave
- mouse_over
- resize
- hover_start
- hover_end
- scroll
Event.type
Event.type
The type of the event
Event.propogate
Event.propogate
bool
Set to false to stop the event from propogating
Event.opposite_direction
Event.opposite_direction
bool
Set to True to propogate the event from parent to child (instead of child to parent)
Event.target
Event.target
DOMNode __link__
The target of the event (the one who emitted it usually)
Event.info
Event.info
Object __link__
An object containing information about the event
EventEmitter
mypygui.core.services.events.event_emitter.EventEmitter
EventEmitter.target
EventEmitter.target
DOMNode __link__
The target of the event emitter (the one who emits the events)
EventEmitter.event_handler
EventEmitter.event_handler
Reference to the event_handler (in order to emit events)
EventEmitter.never_propogate
EventEmitter.never_propogate
bool
Set to True in order to never propogate events that are in the normal direction
EventEmitter.disabled
EventEmitter.disabled
bool
Set to True in order to stop emitting events
EventEmitter.subscribers
EventEmitter.subscribers
dict[Event.Types, Tuple[fn, bool]]
Stores the callback (fn) and whether events emitted by children notified too (bool)
EventEmitter.subscribe
EventEmitter.subscribe
(event_type, callback, notify_child_events?) → None
Subscribe to the events of a particular type
Parameters:
Parameters:
-
event_type : Event.Types
The type of the event to subcribe to -
callback : (event) → None
The function that should be called when the event is emitted -
notify_child_events : bool
Set to True in order to get notified by events emitted by children also
EventEmitter.dispatch
EventEmitter.dispatch
(event) → None
Dispatches an event (by requesting it to the event_handler using
Parameters:
EventEmitter.request_dispatch)Parameters:
-
event : Event
The event
EventEmitter.emit
EventEmitter.emit
(event) → None
Emits the event to all that subscribed to it
Parameters:
Parameters:
-
event : Event
The event
EventEmitter.propogate
EventEmitter.propogate
(event) → None
Propogates the event to parent event emitter (or to children if opposite direction is set to true on the event)
Parameters:
Parameters:
-
event : Event
The event
EventEmitter._dispatch
EventEmitter._dispatch
(event) → None
Dispatches an event (by calling
Parameters:
EventEmitter.emit and EventEmitter.propogate)Parameters:
-
event : Event
The event
EventHandler(ServiceProvider)
mypygui.core.services.events.event_handler.EventHandler
EventHandler.request_dispatch
EventHandler.request_dispatch
(event_emitter, event) → None
Requests for an event to be dispatched
Parameters:
Parameters:
-
event_emitter : EventEmitter
The event emitter that requested dispatch -
event : Event
The event