euporie.core.app.Event

class euporie.core.app.Event(sender: _Sender, handler: Optional[Callable[[_Sender], None]] = None)

Simple event to which event handlers can be attached. For instance:

class Cls:
    def __init__(self):
        # Define event. The first parameter is the sender.
        self.event = Event(self)

obj = Cls()

def handler(sender):
    pass

# Add event handler by using the += operator.
obj.event += handler

# Fire event.
obj.event()