Very simple graphical messagebox in Python useful for console applications with py2exe05 Jan 2013 Matteo Mattei python py2exe tk
When I have to develop background console applications in Python that have to be executed in Windows, I usually use py2exe and Inno Setup for creating installer. However the big issue is always how to report and show errors to the users. My preferred solution is to keep the application as a pure console application (no graphical), set the py2exe application as a window application and handle the errors with graphical messagebox.
And since the Tk library is included in the Python standard library, it is worth using it.
Lines 10 and 11 are needed to don’t show the main Tk window in background. Updated with support for both python 2.7 and python 3.x