repype.textual.confirm
- class repype.textual.confirm.ConfirmScreen(text: str, yes_text: str = 'Yes', no_text: str = 'No', yes_variant: str = 'primary', no_variant: str = 'default', default: Literal['yes', 'no'] | None = None)
Bases:
ModalScreen[bool]A screen that displays a confirmation dialog with a message and two buttons.
- Parameters:
text – The text to display in the dialog.
yes_text – The text to display on the “Yes” button.
no_text – The text to display on the “No” button.
yes_variant – The variant to use for the “Yes” button.
no_variant – The variant to use for the “No” button.
default – The button to focus by default.
- Raises:
AssertionError – If the default argument is invalid.
- async repype.textual.confirm.confirm(app: App, *args, **kwargs) bool
Display a confirmation dialog and wait for it to be dismissed.
- Parameters:
app – The application instance.
args – The arguments to pass to the
ConfirmScreenconstructor.kwargs – The keyword arguments to pass to the
ConfirmScreenconstructor.
- Returns:
True if the “Yes” button was pressed, and False otherwise.