This might look like a duplicate question, but I have pretty much gone through all other threads and couldn't get mine going, so here goes:
I have basically built a python 3 tkinter UI using text box, labels, images, buttons and I am trying to make this an .exe file. Now to try and test this first I made a skeleton tkinter code which is:
import tkinter
top = tkinter.Tk()
top.mainloop()
I followed these steps from another stackoverflow thread: (Top answer by Maria Irudaya) How can I convert a .py to .exe for Python?
My setup.py is:
from cx_Freeze import setup, Executable
base = None
executables = [Executable("tkinter_test.py", base=base)]
packages = ["idna","tkinter"]
options = {
'build_exe': {
'packages':packages,
},
}
setup(
name = "tkinter_test",
options = options,
version = "1",
description = 'test',
executables = executables
)
I followed these step by step and got a directory error for tcl tkl and I went past it by changing them to the Python35-32 directory, now the file is building but its not displaying anything. (It was supposed to open the blank UI with nothing inside it.) It opens and goes off in a flash. When I try to run it using cmd, I get:
C:\UI\tkinter_test\build\exe.win-amd64-3.6>tkinter_test.exe
Traceback (most recent call last):
File "C:\Users\kumsv\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 14, in run
module.run()
File "C:\Users\kumsv\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\initscripts\Console.py", line 26, in run
exec(code, m.__dict__)
File "tkinter_test.py", line 1, in <module>
File "C:\Users\kumsv\AppData\Local\Programs\Python\Python36\lib\tkinter\__init__.py", line 36, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: DLL load failed: The specified module could not be found.
I just want to convert my tkinter Python 3 file into a .exe
file (Not necessarily by cx_freeze) so if someone has done it before with similar tkinter technicalities.