question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Application using customtkinter is not compiled properly

See original GitHub issue

Hello, I would like to report an issue that I have with Nuitka 1.2.7 and Python 3.10 on Windows 11 when trying to compile my program, which uses customtkinter. This is the minimal code:

import tkinter
import customtkinter

customtkinter.set_appearance_mode("System")  # Modes: system (default), light, dark
customtkinter.set_default_color_theme("blue")  # Themes: blue (default), dark-blue, green

app = customtkinter.CTk()  # create CTk window like you do with the Tk window
app.geometry("400x240")

def button_function():
    print("button pressed")

# Use CTkButton instead of tkinter Button
button = customtkinter.CTkButton(master=app, text="CTkButton", command=button_function)
button.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)

app.mainloop()
nuitka nuitest.py --standalone --enable-plugin=tk-inter
Traceback (most recent call last):
  File "C:\Users\trans\PYCHAR~1\NADO-M~1\MICROW~1.DIS\nuitest\NUITES~1.DIS\customtkinter\windows\widgets\theme\__init__.py", line 5, in <module customtkinter.windows.widgets.theme>
  File "C:\Users\trans\PYCHAR~1\NADO-M~1\MICROW~1.DIS\nuitest\NUITES~1.DIS\customtkinter\windows\widgets\theme\theme_manager.py", line 18, in load_theme
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\trans\\PYCHAR~1\\NADO-M~1\\MICROW~1.DIS\\nuitest\\NUITES~1.DIS\\customtkinter\\windows\\widgets\\theme\\../../../assets\\themes\\blue.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\trans\PYCHAR~1\NADO-M~1\MICROW~1.DIS\nuitest\NUITES~1.DIS\nuitest.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "C:\Users\trans\PYCHAR~1\NADO-M~1\MICROW~1.DIS\nuitest\NUITES~1.DIS\customtkinter\__init__.py", line 10, in <module customtkinter>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "C:\Users\trans\PYCHAR~1\NADO-M~1\MICROW~1.DIS\nuitest\NUITES~1.DIS\customtkinter\windows\__init__.py", line 1, in <module customtkinter.windows>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "C:\Users\trans\PYCHAR~1\NADO-M~1\MICROW~1.DIS\nuitest\NUITES~1.DIS\customtkinter\windows\ctk_tk.py", line 9, in <module customtkinter.windows.ctk_tk>

When I manually copy darkdetect and customtkinter, the error changes to the following, probably because customtkinter is ignored for tkinter:

Traceback (most recent call last):
  File "C:\...microwallet.py", line 218, in <module>
AttributeError: 'CTkLabel' object has no attribute 'set_text'

If I remember correctly, I was able to use this in Python 3.8 without much difficulty. Might be before --follow-imports was used instead of --standalone, but my memory may betray me here.

I have also tried to use --include-package-data and --include-data-files for customtkinter and darkdetect (dependency) but to no avail.

My Nuitka version:

1.2.7
Commercial: None
Python: 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30) [MSC v.1933 64 bit (AMD64)]
Flavor: Unknown
Executable: C:\Program Files\Python310\python.exe
OS: Windows
Arch: x86_64
WindowsRelease: 10

On Windows 11, I have installed Python 3.10 using the official installer from https://www.python.org/downloads

python -m pip freeze

absl-py==1.3.0
aiohttp==3.8.1
aiosignal==1.2.0
ansicolors==1.1.8
astunparse==1.6.3
async-timeout==4.0.2
asyncio==3.4.3
attrs==21.4.0
bleach==5.0.1
Brotli==1.0.9
build==0.9.0
cachetools==5.2.0
certifi==2022.6.15
cffi==1.15.1
charset-normalizer==2.1.0
colorama==0.4.6
coloredlogs==15.0.1
commonmark==0.9.1
cryptography==37.0.4
customtkinter==5.0.3
cycler==0.11.0
darkdetect==0.7.1
docutils==0.19
engineering-notation==0.7.0
flatbuffers==22.12.6
fonttools==4.34.4
frozenlist==1.3.0
gast==0.4.0
google-auth==2.15.0
google-auth-oauthlib==0.4.6
google-pasta==0.2.0
grpcio==1.51.1
h5py==3.7.0
humanfriendly==10.0
idna==3.3
importlib-metadata==5.1.0
inflate64==0.3.1
jaraco.classes==3.2.3
keras==2.11.0
keyring==23.11.0
kiwisolver==1.4.3
libclang==14.0.6
Markdown==3.4.1
MarkupSafe==2.1.1
matplotlib==3.5.2
more-itertools==9.0.0
msgpack==1.0.4
multidict==6.0.2
multivolumefile==0.2.3
Nuitka==1.2.7
numpy==1.23.0
oauthlib==3.2.2
opt-einsum==3.3.0
ordered-set==4.1.0
packaging==21.3
pep517==0.13.0
Pillow==9.2.0
pkginfo==1.9.2
protobuf==3.19.6
psutil==5.9.2
py7zr==0.20.2
pyasn1==0.4.8
pyasn1-modules==0.2.8
pybcj==1.0.1
pycairo==1.20.1
pycparser==2.21
pycryptodomex==3.16.0
Pygments==2.13.0
pyparsing==3.0.9
pyppmd==1.0.0
pyreadline3==3.4.1
PySocks==1.7.1
python-dateutil==2.8.2
pytorch3d==0.0.1
pywin32==305
pywin32-ctypes==0.2.0
pyzstd==0.15.3
readme-renderer==37.3
requests==2.28.1
requests-oauthlib==1.3.1
requests-toolbelt==0.10.1
rfc3986==2.0.0
rich==12.6.0
rsa==4.9
shiboken2==5.15.2.1
six==1.16.0
stem==1.8.1
tensorboard==2.11.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.1
tensorflow==2.11.0
tensorflow-estimator==2.11.0
tensorflow-intel==2.11.0
tensorflow-io-gcs-filesystem==0.28.0
termcolor==2.1.1
texttable==1.6.7
tk-tools==0.16.0
tomli==2.0.1
tor==1.0.0
tornado==6.1
twine==4.0.2
typing_extensions==4.4.0
urllib3==1.26.9
webencodings==0.5.1
Werkzeug==2.2.2
wrapt==1.14.1
yarl==1.7.2
zipp==3.11.0
zstandard==0.19.0

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kayhayencommented, Dec 18, 2022

Well, I care about compatibility of course more than what API should be used, so there is merit in this report for sure.

0reactions
kayhayencommented, Dec 21, 2022

This is part of the stable release 1.3 that I just made.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why cant I use my newly downloaded python library?
Ensure that the interpreter you're using in VSCode is aligned to where ... next to your program, and then you can do import...
Read more >
Packaging Tkinter applications for Windows, with ...
We finish off by using InstallForge to create a distributable Windows installer. You always need to compile your app on your target system....
Read more >
How to Position Widgets in Tkinter - with Grid, Place or Pack
Click to position widgets using three different geometric methods: pack, grid and place, with Python's GUI application Tkinter.
Read more >
customtkinter
To use CustomTkinter, just place the /customtkinter folder from this repository next to your program, and then you can do import customtkinter ....
Read more >
TkDocs Tutorial - Installing Tk
Remember, we're using Python 3.x here, not 2.x. As of this writing, the latest 3.9 installer (3.9.0rc1) includes Tk 8.6.8. If, however, you're...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found