Skip to content

Custom dialogs #2763

Answered by freakboy3742
stevebeisner asked this question in Q&A
Aug 12, 2024 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

Your instinct is correct - the best approach at present would be an instance of Window.

Create the instance of Window, possibly with closable=False and/or resizable=False (to ensure that the user can't dismiss the window, or make it a weird size). Add window content matching your widget's input requirement, adding an "OK" button (or whatever acceptance mechanism you want) to the bottom of the window. Add a handler to the OK button that does whatever acceptance handling is required, plus possibly invokes close on the window. Show the window with window.show().

If you want, you can wrap up your custom dialog as a subclass of Window; for extra bonus points, you can make the subclass awaitabl…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@stevebeisner
Comment options

Answer selected by stevebeisner
Comment options

You must be logged in to vote
1 reply
@freakboy3742
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants