Skip to content

ConfirmScreen

Base classes

Name Children Inherits
ModalScreen
textual.screen
A screen with bindings that take precedence over the App's key bindings.

โ‹” Inheritance diagram

graph TD
  107846720182944["dialogs.ConfirmScreen"]
  107846717906624["screen.ModalScreen"]
  107846717858048["screen.Screen"]
  107846685555472["typing.Generic"]
  137699722799616["builtins.object"]
  107846718477920["widget.Widget"]
  107846718489888["dom.DOMNode"]
  107846718374032["message_pump.MessagePump"]
  107846717906624 --> 107846720182944
  107846717858048 --> 107846717906624
  107846685555472 --> 107846717858048
  137699722799616 --> 107846685555472
  107846718477920 --> 107846717858048
  107846718489888 --> 107846718477920
  107846718374032 --> 107846718489888
  137699722799616 --> 107846718374032

๐Ÿ›ˆ DocStrings

Bases: ModalScreen[bool]

A yes / no question.

Source code in src/acptui/ui/screens/dialogs.py
class ConfirmScreen(ModalScreen[bool]):
    """A yes / no question."""

    DEFAULT_CSS = "ConfirmScreen {" + DIALOG_CSS + "}"
    BINDINGS: ClassVar = [
        Binding("y,enter", "answer(True)", "Yes"),
        Binding("n,escape", "answer(False)", "No"),
    ]

    def __init__(self, question: str) -> None:
        super().__init__()
        self.question = question

    def compose(self) -> ComposeResult:
        with Vertical(id="dialog"):
            yield Static(Content(self.question), id="dialog-title")
            yield Static("y: yes ยท n: no", id="dialog-hint")

    def action_answer(self, answer: bool) -> None:
        """Answer."""
        self.dismiss(answer)

action_answer

action_answer(answer: bool) -> None

Answer.

Source code in src/acptui/ui/screens/dialogs.py
def action_answer(self, answer: bool) -> None:
    """Answer."""
    self.dismiss(answer)

:fa-brands-github: Show source on GitHub