Multiple answers in callback from ModalScreen? #3228
Replies: 2 comments
-
When you say that you:
how did it not work? More generally though, you can return any value you like via def on_button_pressed(self, event: Button.Pressed) -> None:
self.dismiss(result=event.button.id) and then your callback handler method could be: def accept_answer(self, answer: str) -> None:
if answer == "continue":
# do the continue thing
elif answer == "quit":
# do the quit thing
else:
# do the return thing This is one of a number of different approaches you could use. |
Beta Was this translation helpful? Give feedback.
-
Ah, awesome, somehow I did not understand what
but now it is obvious .... Thanks very much |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I used this excellent example #2321 to create Yes/No Modal screen with callback, Now I would like do have 3 choices (Yes, No, Cancel) and tried to change the class to int instead of bool but that did not work. I want to confirm the row selection in a DataTable. Here is my code
Beta Was this translation helpful? Give feedback.
All reactions