How to disable Tkinter dialogs while running in batch mode How to disable Tkinter dialogs while running in batch mode tkinter tkinter

How to disable Tkinter dialogs while running in batch mode


OK, in the absence of a better solution, I will say what I did:

import osif not os.environ.has_key('SILENT_MODE'):    import Tkinter    import tkMessageBox     warningWindow = Tkinter.Tk()    warningWindow.withdraw()    tkMessageBox.showwarning("WARNING", "blah, blah, blah")    warningWindow.destroy()

And in the start script:

SET SILENT_MODE=1python -m unittest discover

This is OK I guess, but I'd hoped for something more elegant/generic.