I am starting to learn a bit about Python. I am trying to convert Python Tkinter app into exe file. Converting to exe works fine when Tkinter is not involved. I tryed sample file of setup.py and Tkinter app that you can find on official website of cx_Freeze [http://cx-freeze.readthedocs.io/en/latest/index.html] but still geting a lot of errors [like: KeyError: 'TCL_LIBRARY'
] in CMD when runing build command. On official website is stated that Python 3.6 is supported.
Here is official example of setup.py:
import sys
from cx_Freeze import setup, Executable
base = None
if sys.platform == 'win32':
base = 'Win32GUI'
executables = [
Executable('app.py', base=base)
]
setup(name='simple_Tkinter',
version='0.1',
description='Sample cx_Freeze Tkinter script',
executables=executables
)
And here is official example of test Tkinter app:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from tkinter import Tk, Label, Button, BOTTOM
except ImportError:
from Tkinter import Tk, Label, Button, BOTTOM
root = Tk()
root.title('Button')
Label(text='I am a button').pack(pady=15)
Button(text='Button').pack(side=BOTTOM)
root.mainloop()
Instead of cx_freeze you could try and use Pyinstaller it will do the exact same job you are trying to accomplish.
From pip go ahead and type
pip install pyinstaller
and then in your programs directory run pyinstaller yourprogram.py