Convert Tkinter py file into EXE file Convert Tkinter py file into EXE file tkinter tkinter

Convert Tkinter py file into EXE file


In your Python directory's DLLs folder you will find tk86t.dll and tcl86t.dll. You have to copy them into the build folder with the main.py you want to compile.

Then you have to add these two files to the include_files parameter in your setup.py.

Now, your setup.pyshould look like something like this :

import osfrom cx_Freeze import setup, Executableos.environ['TCL_LIBRARY'] = 'c:/python36/tcl/tcl8.6'os.environ['TK_LIBRARY'] = 'c:/python36/tcl/tk8.6'buildOptions = dict(    packages = [],    excludes = [],    include_files=['c:/python36/DLLs/tcl86t.dll', 'c:/python36/DLLs/tk86t.dll'])import sysbase = 'Win32GUI' if sys.platform=='win32' else Noneexecutables = [    Executable('editor.py', base=base)]setup(name='editor',      version = '1.0',      description = '',      options = dict(build_exe = buildOptions),      executables = executables)

Of course you may have to adapt the directories paths to make it work.