CustomTkinter
CustomTkinter copied to clipboard
__init__.py loading default theme does not work with pyinstaller --onefile
The following line loads the default theme... https://github.com/TomSchimansky/CustomTkinter/blob/22b4dfb2d33bf877c96c316afa2456f28bcd560a/customtkinter/init.py#L17
If you use pyinstaller with the --onefile option you will most likely get a FileNotFoundError with a message indicating that blue.json does not exist. There is a fix for this that can be used within your code that can be found here, however, even if you use your own theme file or load one of the default theme files using this fix in your code, the error persists as the __init__.py file will always try to first load blue.json on its own.
With that said, would it be possible to move loading a default theme out of __init__.py so it can be done "differently" if need be? Is there another way someone would suggest suppressing this issue?
Thanks to everyone who has been contributing to this project, Tkinter has needed something exactly like this for a long time in my opinion.
I cannot move ThemeManager.load_theme("blue") out of the init file, but I surrounded it with a try except block. So when you load a theme again in your own main file with the fixed path you mentioned it should work.
Yep, I think that does the trick. Thanks!