Skip to content

Message

MouseEvent

Bases: AttrEnum

Mouse event message type enumerator to use as MouseMsg type attribute.

MOVE = 'MOVE'

LEFT_CLICK = 'LEFT_CLICK'

Left button press and release. Isn't assigned by MouseIn but can be sent with MouseOut.

MIDDLE_CLICK = 'MIDDLE_CLICK'

Middle button press and release. Isn't assigned by MouseIn but can be sent with MouseOut.

RIGHT_CLICK = 'RIGHT_CLICK'

Right button press and release. Isn't assigned by MouseIn but can be sent with MouseOut.

LEFT_PRESS = 'LEFT_PRESS'

MIDDLE_PRESS = 'MIDDLE_PRESS'

RIGHT_PRESS = 'RIGHT_PRESS'

LEFT_RELEASE = 'LEFT_RELEASE'

MIDDLE_RELEASE = 'MIDDLE_RELEASE'

RIGHT_RELEASE = 'RIGHT_RELEASE'

SCROLL_UP = 'SCROLL_UP'

SCROLL_DOWN = 'SCROLL_DOWN'

SCROLL_LEFT = 'SCROLL_LEFT'

SCROLL_RIGHT = 'SCROLL_RIGHT'

MouseMsg

MouseMsg(type: MouseEvent, x: int, y: int, *, source: None | MouseIn = None)

Bases: Msg

Keyboard event message

Parameters:

  • type (MouseEvent) –

    Mouse event type

  • x (int) –

    Event horizontal axis coordinates

  • y (int) –

    Event vertical axis coordinates

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

    The MouseIn instance that generated the message

Tip

Run GUI and Enable mouse input. Use log to get mouse events you need.

ctime

ctime: float

Message creation time in "Unix time" format

type

type: MouseEvent

Mouse event type

x

x: int = x

Event horizontal screen coordinates

y

y: int = y

Event vertical screen coordinates

source

source: None | MouseIn

Input port instance that generated the message

matches

matches(
    type: None | Container[MouseEvent] | MouseEvent = None,
    x: None | Container[int] | int = None,
    y: None | Container[int] | int = 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