Skip to content

fontlab.flEvent

flEvent

Mouse and keyboard event.

What is flEvent?

flEvent is the small native event record used by the editor's own tools. It records a native event category and Qt modifier-key flags. The mouse-specific data is exposed separately by flMouseEvent.

Callback tools registered with flWorkspace.registerPythonTool() receive Qt QMouseEvent/QKeyEvent wrappers rather than this native record. See the tool callback contract.

flEvent exposes only type and modifiers. For mouse coordinates, buttons and movement, use flMouseEvent.

Base Properties (all events)

Name Type Access Description
type EventType rw What kind of event this is. The class dictionary flEvent.EventType contains MouseEvent, WheelEvent and MovementEvent. These are native categories, not Qt event IDs.
modifiers int rw A bitmask of which modifier keys were held when the event fired. Combine with Qt's modifier constants: Qt.ShiftModifier, Qt.ControlModifier (Ctrl/Cmd), Qt.AltModifier (Alt/Option), Qt.MetaModifier. Example: bool(event.modifiers & Qt.ShiftModifier) — is Shift held?

Mouse event data

These fields belong to flMouseEvent, not to the base event. Global screen positions must be mapped through the relevant viewport before converting to glyph coordinates.

Creating a tool

For callback-based tool registration and cleanup, see flWorkspace. For the base event, use flEvent(event_type) or flEvent(event_type, modifiers); there is no public no-argument constructor.

flEvent.EventType

Use the flEvent.EventType dictionary with subscription.

Key Native value Description
MouseEvent flEvent::EventType::MouseEvent Native enum value.
WheelEvent flEvent::EventType::WheelEvent Native enum value.
MovementEvent flEvent::EventType::MovementEvent Native enum value.

Constructors: flEvent(flEvent) flEvent(flEvent(EventType type[, int modifiers=-1])

Native bases: object

Captured native MRO: flEvent, object

Native new allocation evidence (not an init overload): (args, *kwargs) Create and return a new object. See help(type) for accurate signature.

Supplemental documentation: An event with type (EventType) and modifiers (int) attributes and an EventType dict. It is created as a copy flEvent(flEvent) or as flEvent(EventType type[, int modifiers=-1]).

Source: FontLab Proteus API documentation

Source: generated/fontlab.py: flEvent captured declaration

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
EventType attribute dict
__init__ function (self, /, *args: Any, **kwargs: Any) -> None Initialize self. (shared captured text)
modifiers attribute Any
type attribute Any