Python Forum
[Tkinter] Problem with tkinter when creating .exe file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Problem with tkinter when creating .exe file
#1
I'm currently attempting to take one of my projects and turn it into a .exe file with cxfreeze. Unfortunately I've run into a problem I just cant seem to figure out, I'm hoping maybe someone can tell me what I'm doing wrong here?

So here's the thing...

import sys
from cx_Freeze import setup, Executable

# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]}

# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(  name = "testproject1",
        version = "0.1",
        description = "My GUI application!",
        options = {"build_exe": build_exe_options},
        executables = [Executable("Structured map.py", base=base)])
This is my setup file that I use to start the whole process. Both this file and my project lies in the root venv folder which also contains the actual python installation and all modules I have ever used.

I use "python setup.py" to initialize the building of the new file. Everything goes through, no issues so far...

When the whole process is done I navigate to the "build" file which gets written to the venv folder and inside that folder lies the new .exe file.

Here's the confusing part.

When I launch it i get the following error.

Traceback (most recent call last):
File
"C:\users\owner\desktop\untitled\venv\lib\site-packages\cx_freeze\initscripts\console.py"
Line 37, in run exec(code, {__name__':'__main__})
File "Structured map.py" line 3, in <module>
ModuleNotFoundError: No module named 'tkinter'

Why is it not finding the tkinter module? I can run the "structured map" file just fine with tkinter imported and it will find it, I have also checked stack overflow and done quite a bit of research but can't find any solution.

Any help is appreciated :)
Reply


Messages In This Thread
Problem with tkinter when creating .exe file - by Jan_97 - Feb-26-2020, 07:24 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Creating a function interrupt button tkinter AnotherSam 2 5,569 Oct-07-2021, 02:56 PM
Last Post: AnotherSam
  [TKINTER] Problems creating directories in a selected path Vulera 2 2,789 Aug-10-2021, 06:38 PM
Last Post: Vulera
  Python3 tkinter radiobutton problem Nick_tkinter 14 6,086 Feb-15-2021, 11:01 PM
Last Post: Nick_tkinter
  tkinter python button position problem Nick_tkinter 3 3,582 Jan-31-2021, 05:15 AM
Last Post: deanhystad
  [Tkinter] ClockIn/Out tkinter problem Maryan 2 2,229 Oct-12-2020, 03:42 AM
Last Post: joe_momma
  tkinter| listbox.insert problem Maryan 3 3,540 Sep-29-2020, 05:34 PM
Last Post: Yoriz
  Tkinter problem DPaul 6 4,173 May-28-2020, 03:40 PM
Last Post: DPaul
  [Tkinter] Tkinter custom widget styling and creating custom theme karolp 6 4,871 May-06-2020, 06:11 PM
Last Post: karolp
  Creating and destroying dynamic labels in Tkinter MarcusRoberts 1 4,319 May-02-2020, 06:49 PM
Last Post: Yoriz
  [Tkinter] Tkinter - I need to read file excel from GUI app to script file johnjh 0 10,745 Apr-17-2020, 08:14 PM
Last Post: johnjh

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020