Now that you understand how to use messagebox, error dialogs should be easy to implement. The Application.on_save() method already displays errors in the status bar; we just need to make this error display in an error message box as well by performing the following steps:
- First, we'll need to import it in application.py as follows:
from tkinter import messagebox
- Now, in the on_save() method after the check for errors, we'll set up the message for the error dialog. We'll make a bullet list of the fields with errors by joining them with "\n *". Unfortunately, messagebox doesn't support any sort of markup, so constructs like bullet lists need to be built manually using regular characters, as in the following: