Skip to content


The base class for all messages (including events).

Message class

def __init__(self):

Base class for a message.

ALLOW_SELECTOR_MATCH class-attribute

ALLOW_SELECTOR_MATCH: set[str] = set()

Additional attributes that can be used with the on decorator.

These attributes must be widgets.

control property

control: Widget | None

The widget associated with this message, or None by default.

handler_name class-attribute

handler_name: str

Name of the default message handler.

is_forwarded property

is_forwarded: bool

Has the message been forwarded?

prevent_default method

def prevent_default(self, prevent=True):

Suppress the default action(s). This will prevent handlers in any base classes from being called.

Name Type Description Default
prevent bool

True if the default action should be suppressed, or False if the default actions should be performed.


stop method

def stop(self, stop=True):

Stop propagation of the message to parent.

Name Type Description Default
stop bool

The stop flag.