Creating message boxes – information, warning, and error

A message box is a pop-up window that gives feedback to the user. It can be informational, hinting at potential problems, and even catastrophic errors.

Using Python to create message boxes is very easy.

Getting ready

We will add functionality to the Help | About menu item we created in the previous recipe. The typical feedback to the user when clicking the Help | About menu in most applications is informational. We start with this information and then vary the design pattern to show warnings and errors.

How to do it...

Add the following line of code to the top of the module where the import statements live:

from tkinter import messagebox as mBox

Next, we will create a callback function that will ...

Get Python GUI Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.