CustomTkinter
CustomTkinter copied to clipboard
CustomTkinter assets in wrong directory
When compiling a program containing customtkinter, for some reason it drops its asset folder and sits a level too deep for the program to look for. It gets compiled to site-packages but It looks for itself in one folder level higher.
below are screenshots of my solution which allows the program to successfully compile and display

When you say
When compiling a program containing customtkinter
you mean you are trying to execute the script, or pyinstaller? ( you need extra steps for pyinstaller) -> https://github.com/TomSchimansky/CustomTkinter/wiki/Packaging
Sometimes Windows can't figure it out how to solve long paths...
https://www.thewindowsclub.com/how-to-enable-or-disable-win32-long-paths-in-windows-11-10
You Could try to use somethings like this,
import sys
#change for your path
sys.path.append("your\\custom\\windows\\path\\to\\CustomTkinter")
I use Linux and I've never found this issue. But, yes, maybe it's something related to CTk.
sorry for the ambiguity, this was when I was using auto-py-to-exe to precompile my code into a .exe
I can only try to guess here, since I've never used auto-py-to-exe . I imagine auto-py-to-exe doesn't automatically add assets folder and its contents inside site-packages.
What happens if you copy the assets folder and paste inside the compiled folder located at site-packages/CustomTkinter by yourself? Does it work?
Something else, are you using auto-py-to-exe to hide your app source code ? Because I achieved that using some rust libs to hide my python code, and I was thinking about working more on that so we can have another option to package and distribute ctk projects
I can paste the assests folder in the location it looks for them and everything works. But there are a few wonky GUI bugs that make my app look weird.
I have a similar problem afer compiling with pyinstaller.
Here's a doc: https://github.com/TomSchimansky/CustomTkinter/wiki/Packaging#windows-pyinstaller-auto-py-to-exe
I'm sad I can't use the --onefile option...
Traceback (most recent call last):
File "customtkinter_init_.py", line 20, in
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "\my_path\my_folder\my_file.py", line 3, in
The .json theme file for CustomTkinter could not be found. If packaging with pyinstaller was used, have a look at the wiki: https://github.com/TomSchimansky/CustomTkinter/wiki/Packaging#windows-pyinstaller-auto-py-to-exe [22248] Failed to execute script 'controle_neige' due to unhandled exception! `
Yeah, same issue over here. It really bums me out that I can't use the single file option. It ruins the experience as I don't want to send my colleagues/clients a zip file containing all of the necessary files. Is there no way at all to achieve in getting a single .exe file?