cls_BaseEvent - almarklein/visvis GitHub Wiki

Inherits from object.

The BaseEvent is the simplest type of event.

The purpose of the event class is to provide a way to bind/unbind to events and to fire them. At the same time, it is the place where the properties of the event are stored (such mouse location, key being pressed, ...).

In Qt speak, an event is a combination of an event and a signal. Multiple callbacks can be registered to an event (signal-paradigm). A callback may chose to override previously registered callbacks by using setHandled(). If there are no handlers, or if the event is explicitly ignored (using the Ignore method) by all handlers, the event is propagated to the parent object (event paradigm).

To register or unregister a callback, use the Bind and Unbind methods When fired, all handlers that are bind to this event are called, until the event is set as handled. The handlers are called with the event object as an argument. The event.owner provides a reference of what wobject/wibject fired the event.

The BaseEvent class implements the following properties:
eventName, hasHandlers, modifiers, owner, type

The BaseEvent class implements the following methods:
Accept, Bind, Fire, Ignore, Set, SetHandled, Unbind

Properties

The name of this event.

Get whether this event has handlers registered to it.

The modifier keys active when the event occurs.

The object that this event belongs to.

The type (class) of this event.

Methods

Accept the event, preventing it from being propagated to the parent object. When an event handler is called, the event is accepted by default.

Add an eventhandler to this event.

The callback/handler (func) must be a callable. It is called with one argument: the event instance, which contains the mouse location for the mouse event and the keycode for the key event.

Fire the event, calling all functions that are bound to it, untill the event is handled (a handler returns True).

If no handlers are present or if the event is explicitly ignored, the event is propagated to the owners parent. This only apples to events for which this is approprioate and only if eventArgs are given.

Clears the accept flag parameter of the event object. Clearing the accept parameter indicates that the event receiver does not want the event. If none of the handlers for this event do not want it, the event might be propagated to the parent object.

Set the event properties before firing it. In the base event the only property is the modifiers state, a tuple of the modifier keys currently pressed.

Mark the event as handled, preventing any subsequent handlers from being called. Use this in a custom handler to override the existing handler. The same behavior is obtained when the handler returns True.

Unsubscribe a handler, If func is None, remove all handlers.

⚠️ **GitHub.com Fallback** ⚠️