add_event_handler#
- LineGraphic.add_event_handler(*args)#
Register an event handler. Can also be used as a decorator.
- Parameters:
callback (callable, the first argument) – Event handler, must accept a single event argument
*types (strings) –
event types, ex: “click”, “data”, “colors”, “pointer_down”
supported_events
will return a tuple of all event type strings that this graphic supports. See the user guide in the documentation for more information on events.
Example
def my_handler(event): print(event) graphic.add_event_handler(my_handler, "pointer_up", "pointer_down")
Decorator usage example:
@graphic.add_event_handler("click") def my_handler(event): print(event)