I'm, trying to make my app right now, but with a lot of errors. I tried to use images as backgrounds for the buttons so that they'll look better. But whenever I run my program, open up another window with the button I made, there is this error:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\szab9\AppData\Local\Programs\Python\Python311\Lib\tkinter\__init__.py", line 1948, in __call__
return self.func(*args)
^^^^^^^^^^^^^^^^
File "C:\Users\szab9\OneDrive\Asztali Gép\VM\add_element.py", line 21, in addElementFunc
add_element.iconphoto(False, logo)
File "C:\Users\szab9\AppData\Local\Programs\Python\Python311\Lib\tkinter\__init__.py", line 2183, in wm_iconphoto
self.tk.call('wm', 'iconphoto', self._w, *args)
_tkinter.TclError: can't use "pyimage18" as iconphoto: not a photo image
I'm using the same logo for every window, and I usually use this logic:
logo = PhotoImage(file="*path*")
root.iconphoto(False, logo)
If I run the first window, it's fine. After I open up the other window, it just gives an error mention previously. If I open the "other" python file, it just runs perfectly fine. (python button1_functionality.py)
Please fix my difficulties, it may be because I'm using the same photo over and over again, but how do I fix that? Please help.