Skip to content

textual.binding

This module contains the Binding class and related objects.

See bindings in the guide for details.

ActiveBinding

Bases: NamedTuple

Information about an active binding (returned from active_bindings).

binding instance-attribute

binding

The binding information.

enabled instance-attribute

enabled

Is the binding enabled? (enabled bindings are typically rendered dim)

node instance-attribute

node

The node where the binding is defined.

Binding dataclass

Binding(
    key,
    action,
    description="",
    show=True,
    key_display=None,
    priority=False,
)

The configuration of a key binding.

action instance-attribute

action

Action to bind to.

description class-attribute instance-attribute

description = ''

Description of action.

key instance-attribute

key

Key to bind. This can also be a comma-separated list of keys to map multiple keys to a single action.

key_display class-attribute instance-attribute

key_display = None

How the key should be shown in footer.

priority class-attribute instance-attribute

priority = False

Enable priority binding for this key.

show class-attribute instance-attribute

show = True

Show the action in Footer, or False to hide.

BindingError

Bases: Exception

A binding related error.

InvalidBinding

Bases: Exception

Binding key is in an invalid format.

NoBinding

Bases: Exception

A binding was not found.