Problems with Tkinter in py2exe Problems with Tkinter in py2exe tkinter tkinter

Problems with Tkinter in py2exe


Does your setup.py script include init.tcl in the data_files option? The py2exe list of options says that's how you should include images and other required data files.

Edit:

Your setup script specifies that your program should be converted to a console exe. If you want a GUI program (which you do, since you're using Tkinter), you need to use the windows option:

setup(windows=[r'C:\Python26\Random Password Generator.py'])

Py2exe should correctly include Tkinter's dependencies. If not, you can manually include init.tcl:

setup(data_files=['C:\Python26\tcl\tcl8.5\init.tcl'],      windows=[r'C:\Python26\Random Password Generator.py'])


Ensure that tcl is installed in C:\Users\splotchy\lib\tcl8.5 or C:\Users\lib\tcl8.5.

If you want to see the error messages for longer, run your program from a command prompt.


I found a bug on the virutalenv site which suggested the following https://github.com/pypa/virtualenv/issues/93

for windows in your directory "C:\Environments\VirtualEnv\Scripts\activate.bat" just add which are set to the right path to TCL and TK for your python version

set "TCL_LIBRARY=C:\Python27\tcl\tcl8.5" set "TK_LIBRARY=C:\Python27\tcl\tk8.5" 

restart your cmd or shell

I believe that the TCL location have changed from there default ones.