pycram.world_concepts.event
Module Contents
Classes
Base implementation of events in PyCRAM. |
- class pycram.world_concepts.event.Event
Base implementation of events in PyCRAM. Events allow to attach handler methods to events that fire for specific occurences in the world.
- Variables:
handler – List of methods that are called when this event is fired.
- __call__
Allows to directly call the reference.
- add(handler: typing_extensions.Callable) None
Adds a new handler to the list of handlers. All handler methods are called when this event is fired. Handler have to take the event sender as parameter as well as args* which can contain further parameter.
- Parameters:
handler – A method that should be added
- remove(handler: typing_extensions.Callable) None
Removes a method from the list of handlers, the method will not be called when the event is fired.
- Parameters:
handler – The method that should be removed.
- fire(sender: typing_extensions.Any, earg: typing_extensions.Optional[typing_extensions.Any] = None) None
Fire this event, this causes every method to be called with a sender as well as additional args.
- Parameters:
sender – The entity that fired the event.
earg – Additional arguments.