Asking for user confirmation
Other types of dialogs included in Tkinter are those used to ask for user confirmation, such as the ones shown when we want to save a file and are about to override an existing one with the same name.
These dialogs differ from the preceding one because the values returned by the functions will depend on the confirmation button clicked by the user. This way, we can interact with the program to indicate whether to continue or cancel the action.
Getting ready
In this recipe, we will cover the remaining dialog functions defined in the tkinter.messagebox
module. Each button is labeled with the type of dialog that is opened when clicked:

Since there are a few differences among these dialogs, you can try them out to see which one may better fit your needs for each situation:

How to do it...
As we did in our preceding example, we will import tkinter.messagebox
with the import ... as
syntax and call each function with title
and message
:
import tkinter as tk
import tkinter.messagebox...