Skip to content

textual_enhanced.dialogs

Provides useful dialogs.

Confirm

Confirm(title, question, yes_text='Yes', no_text='No')

Bases: ModalScreen[bool]

A modal dialog for confirming things.

Parameters:

Name Type Description Default

title

str

The title for the dialog.

required

question

str

The question to ask the user.

required

yes_text

str

The text for the yes button.

'Yes'

no_text

str

The text for the no button.

'No'

action_no

action_no()

Send back the negative response.

action_yes

action_yes()

Send back the positive response.

compose

compose()

Compose the layout of the dialog.

HelpScreen

HelpScreen(help_for=None)

Bases: ModalScreen[None]

The help screen.

Parameters:

Name Type Description Default

help_for

Screen[Any] | None

The screen to show the help for.

None

action_close

action_close()

Close the help screen.

compose

compose()

Compose the layout of the help screen.

input_help

input_help(node)

Build help from the bindings and commands provided by a DOM node.

Parameters:

Name Type Description Default

node

DOMNode

The node that might provide commands.

required

Returns:

Type Description
str

The help text.

visit

visit(event)

Visit any link clicked in the help.

ModalInput

ModalInput(placeholder=None, initial='', classes=None)

Bases: ModalScreen[str | None]

A modal screen to get input from the user.

Parameters:

Name Type Description Default

placeholder

str | None

The placeholder text to use.

None

initial

str

The initial value for the input.

''

classes

str | None

The CSS classes of the modal input.

None

accept_input

accept_input()

Accept the input.

action_escape

action_escape()

Escape out without getting the input.

compose

compose()

Compose the input dialog.