The most simple type of GUI is the alert. Just print something to inform the user of a result or event in a graphical box:
Alerts
How to do it...
Alerts in tkinter are managed by the messagebox object and we can create one simply by asking messagebox to show one for us:
from tkinter import messagebox def alert(title, message, kind='info', hidemain=True): if kind not in ('error', 'warning', 'info'): raise ValueError('Unsupported alert kind.') show_method = getattr(messagebox, 'show{}'.format(kind)) show_method(title, message)
Once we have our alert helper in place, we can initialize a Tk interpreter and show as many alerts as we want:
from tkinter...