How it works...

First, we imported the tkinter.messagebox module with the shorter alias mb. This module was named tkMessageBox in Python 2, so this syntax also helps us to isolate compatibility issues in a single statement.

Each dialog is commonly used depending on the type of information that is notified to the users:

  • showinfo: The operation completed successfully
  • showwarning: The operation completed but something did not behave as expected
  • showerror: The operation failed due to an error

These three functions receive two strings as input arguments: the first one is displayed on the title bar, and the second one corresponds to the message shown by the dialog.

Dialog messages can also spawn across multiple lines by adding the new line character,  .

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset