TomSchimansky / CustomTkinter

A modern and customizable python UI-library based on Tkinter
MIT License
11.33k stars 1.07k forks source link

Problem in theme_manager with an executable #1983

Open MiKalem898 opened 1 year ago

MiKalem898 commented 1 year ago

I'm coding an app with the package and when I want to start the script as an executable file (I use pyinstaller), I get this error: *`Traceback (most recent call last): File "main.py", line 1, in File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module File "customtkinter__init__.py", line 20, in

import widgets

File "customtkinter\theme_manager.py", line 25, in load_theme cls.theme["text"] = cls.theme["text"]["Windows"] KeyError: 'text'`

I don't understand why I got this because, in my other projects wich use this module too, I didn't get this error

I saw that another person got this too, but I already have the latest version of the module, and the error doesn't appear when I start the script in my IDE but only with an exe file

MiKalem898 commented 1 year ago

It's better in picture image

bfedie518 commented 1 year ago

CTk doesn't always play nice with PyInstaller. Did you follow the instructions here? https://customtkinter.tomschimansky.com/documentation/packaging

MiKalem898 commented 1 year ago

CTk doesn't always play nice with PyInstaller. Did you follow the instructions here? https://customtkinter.tomschimansky.com/documentation/packaging

Yes, I did, but the error still exists. Sometimes when I have any error I try to create a new project in which I write the same code, and sometimes it works, I'll try for 2nd time (I tried yesterday for this project in vain)

its-ahad commented 1 year ago

@MiKalem898 can you show your code or command of pyinstaller for proper guidance?

MiKalem898 commented 1 year ago

@MiKalem898 can you show your code or command of pyinstaller for proper guidance?

Sry I didn't show ur answer

I do that often and it works ?? pyinstaller --add-data "c:/users/mikal/pycharmprojects/klink-python/venv/lib/site-packages/customtkinter;customtkinter/" main.py