Skip to content

textual.message

The base class for all messages (including events).

Message

Message()

Base class for a message.

ALLOW_SELECTOR_MATCH class-attribute

ALLOW_SELECTOR_MATCH = set()

Additional attributes that can be used with the on decorator.

These attributes must be widgets.

control property

control

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

handler_name class-attribute

handler_name

Name of the default message handler.

is_forwarded property

is_forwarded

Has the message been forwarded?

prevent_default

prevent_default(prevent=True)

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

Parameters:

Name Type Description Default

prevent

bool

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

True

set_sender

set_sender(sender)

Set the sender of the message.

Parameters:

Name Type Description Default

sender

MessagePump

The sender.

required
Note

When creating a message the sender is automatically set. Normally there will be no need for this method to be called. This method will be used when strict control is required over the sender of a message.

Returns:

Type Description
Self

Self.

stop

stop(stop=True)

Stop propagation of the message to parent.

Parameters:

Name Type Description Default

stop

bool

The stop flag.

True