Dialogs are windows popped up by a script to provide or request additional information. They come in two flavors, modal and nonmodal:
These dialogs block the rest of the interface until the dialog window is dismissed; users must reply to the dialog before the program continues.
These dialogs can remain on-screen indefinitely without interfering with other windows in the interface; they can usually accept inputs at any time.
Regardless of their modality, dialogs are generally implemented
object we met in the prior section, whether you make the
Toplevel or not. There are essentially three
ways to present pop-up dialogs to users with tkinter—by using common
dialog calls, by using the now-dated
Dialog object, and by creating custom dialog
Toplevels and other
kinds of widgets. Let’s explore the basics of all three
Because standard dialog calls are simpler, let’s start here first. tkinter comes with a collection of precoded dialog windows that implement many of the most common pop ups programs generate—file selection dialogs, error and warning pop ups, and question and answer prompts. They are called standard dialogs (and sometimes common dialogs) because they are part of the tkinter library, and they use platform-specific library calls to look like they should on each platform. A tkinter file open dialog, for instance, looks like any other on Windows.
All standard dialog calls are modal (they don’t ...