Skip to content

GUI Event Message

GuiEvent

Bases: AttrEnum

GUI event type enumerator to use as GuiEventMsg type attribute.

CONTENT_SET = 'CONTENT_SET'

COLOR_SET = 'COLOR_SET'

RANGE_SET = 'RANGE_SET'

TRIGGERED = 'TRIGGERED'

TOGGLED = 'TOGGLED'

SELECTED = 'SELECTED'

VALUE_CHANGED = 'VALUE_CHANGED'

GuiEventMsg

GuiEventMsg(
    type: GuiEvent,
    data: str | int | bool | Sequence | None = None,
    *,
    source: None | GuiWidget = None
)

Bases: Msg

GUI interaction message produced by GUI widget port.

Parameters:

  • source (Input | None, default: None ) –

    Input port instance that generated the message

ctime

ctime: float

Message creation time in "Unix time" format

type

type: GuiEvent = type

GUI event type.

data

data: str | int | bool | Sequence | None = data

New value set by event.

Data meaning for event types:
TRIGGERED - None CONTENT_SET - New content COLOR_SET - New text color TOGGLED - New toggle state SELECTED - Selected item text VALUE_CHANGED - New value RANGE_SET - New value range

source

source: None | GuiWidget

Input port instance that generated the message

matches

matches(
    type: None | Container[GuiEvent] | GuiEvent = None,
    data: None | Container | str | int | bool | Sequence = None,
) -> bool

Checks if message's attributes match all provided attribute conditions:

  1. If condition is None or omitted, it matches anything.

  2. If condition equals attribute, it matches the attribute.

  3. If condition is a container and contains the attribute, it matches the attribute.

Use Not(condition) to invert condition matching.

Returns:

  • bool

    True if all attributes match, False if any does not match