israel-dryer / ttkbootstrap

A supercharged theme extension for tkinter that enables on-demand modern flat style themes inspired by Bootstrap.
MIT License
1.78k stars 358 forks source link

_tkinter.TclError: couldn't recognize image data #584

Open QingyuFeng opened 1 month ago

QingyuFeng commented 1 month ago

Desktop (please complete the following information):

ttkbootstrap version: 1.10.1 OS: Macos sonoma 14.5 python version: 3.9.6

Describe the bug

I was trying to develop an app with ttkbootstrap. However, when I was testing the package, it worked pretty on windows 10. But, when I was trying it on Macos, an error occurred. I created a virtual environment using the Macos default python version, and try to run the text reader demo (https://ttkbootstrap.readthedocs.io/en/latest/gallery/textreader/), it is not working. I checked online and found it was a common error with PhotoImage.

To Reproduce

DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning. Traceback (most recent call last): File "/Users/fengqingyu/Documents/appDevMaster/emc_ecoevalt/src/test_notebook.py", line 47, in app = ttk.Window("Text Reader", "sandstone") File "/Users/fengqingyu/Documents/appDevMaster/emc_ecoevalt/env/lib/python3.9/site-packages/ttkbootstrap/window.py", line 231, in init self._icon = tkinter.PhotoImage(master=self, data=Icon.icon) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/tkinter/init.py", line 4064, in init Image.init(self, 'photo', name, cnf, master, **kw) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/tkinter/init.py", line 4009, in init self.tk.call(('image', 'create', imgtype, name,) + options) _tkinter.TclError: couldn't recognize image data

Expected behavior

No response

Screenshots

No response

Additional context

No response