Here are the steps to follow to create a message box in Python:
- Open GUI_tabbed_all_widgets_both_tabs.py from Chapter 2, Layout Management, and save the module as GUI_message_box.py.
- Add the following line of code to the top of the module where the import statements live:
from tkinter import messagebox as msg
- Next, create a callback function that will display a message box. We have to place the code of the callback above the code where we attach the callback to the menu item, because this is still procedural and not OOP code.
Add the following code just above the lines where we create the help menu:
def _msgBox(): msg.showinfo('Python Message Info Box', 'A Python GUI created using tkinter:\nThe year is 2019.')
The preceding ...