I tried renaming my .py file to .pyw. But compiling with py2exe does not make a difference.

I tried using root.withdraw() but all it does is freeze the application, prevent the initial canvas from popping up, and fail to remove the command prompt window anyways.

Does anyone have a solution?

My root is:

root = Tk()

A typical py2exe program you can use for Tkinter code ...

A simple py2exe program used for Tkinter programs.
Run this program to create a windows exe file with py2exe.
Run it in a folder that also contains your source code file.

It will create 2 folders named build and dist.

The build folder is temporary info and can be deleted.

Distribute whatever is in the dist folder.

Your library.zip file contains your optimized byte code, and all
needed modules.  This file together with the Python interpreter
(eg. Python25.dll) should accompany the created executable file.
Note that you might be able to share this large library file with
other Python/Tkinter based .exe files.

The MSVCR71.dll can be distributed and is often already in the
Windows/system32 folder.  Python26 expects msvcm90.dll, msvcp90.dll
and msvcr90.dll

w9xpopen.exe is needed for os.popen() only, can be deleted otherwise.

from distutils.core import setup
import py2exe
import sys


# insert your own source code filename below ...
code_file = 'Tk_ParResist1.pyw'
# replace windows with console for a console program
setup(windows = [{"script": code_file}])
This article has been dead for over six months. Start a new discussion instead.