Skip to content

Binding

A binding maps a key press on to an action.

See bindings in the guide for details.

ActiveBinding class

Bases: NamedTuple

Information about an active binding (returned from [active_bindings][textual.screen.active_bindings]).

binding instance-attribute

binding: Binding

The binding information.

enabled instance-attribute

enabled: bool

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

node instance-attribute

node: DOMNode

The node where the binding is defined.

Binding class

The configuration of a key binding.

action instance-attribute

action: str

Action to bind to.

description instance-attribute class-attribute

description: str = ''

Description of action.

key instance-attribute

key: str

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

key_display instance-attribute class-attribute

key_display: str | None = None

How the key should be shown in footer.

priority instance-attribute class-attribute

priority: bool = False

Enable priority binding for this key.

show instance-attribute class-attribute

show: bool = True

Show the action in Footer, or False to hide.

BindingError class

Bases: Exception

A binding related error.

InvalidBinding class

Bases: Exception

Binding key is in an invalid format.

NoBinding class

Bases: Exception

A binding was not found.