Hide console window with Tkinter and cx_Freeze

Rhys picture Rhys · Apr 2, 2011 · Viewed 13.4k times · Source

I am using cx_freeze to freeze a tkinter app. When I run the exe I get a wonderfully USELESS console window along with my tkinter GUI.

I would like to remove/hide this useless black window.

I've seen threads that suggest the following:

root = tkinter.Tk()
root.withdraw()

The above code does the opposite of what I want. It hides my GUI, while the useless black window remains. I would like it to be the other way around.

Answer

Noufal Ibrahim picture Noufal Ibrahim · Apr 2, 2011

I remember reading somewhere that on Windows if you specify your file extension as .pyw, it will launch with pythonw.exe (without a console window). Does that work for you?