Alert¶
- class pyto_ui.Alert(title: str, message: str)¶
A class representing an alert.
Example:
from pyto_ui import Alert alert = Alert("Hello", "Hello World!") alert.add_action("Ok") alert.add_cancel_action("Cancel") if (alert.show() == "Ok"): print("Good Bye!")
- add_action(title: str)¶
Adds an action with given title.
- Parameters:
title – The title of the action.
- add_cancel_action(title: str)¶
Adds a cancel action with given title. Can only be added once.
- Parameters:
title – The title of the action.
- add_destructive_action(title: str)¶
Adds a destructive action with given title.
- Parameters:
title – The title of the action.
- show() str¶
Shows alert.
Returns the title of the selected action.
- Return type:
str