How to do it...

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

Next, create a callback function that will display a message box. We have to locate 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:

GUI_message_box.py

Clicking Help | About now causes the following pop-up window to appear:

Let's transform this code into a warning message box pop-up window, instead. Comment out the previous line and add the following code:

Running the preceding code will now result in the following slightly modified message box:

Displaying an error message box is simple and usually warns the user of a serious problem. As we did in the previous code snippet, comment out the previous line and add the following code, as we have done here:

The error message looks like this:

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

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