0

why i can't use wm_iconphoto two times?

root = Tk()
root_2 = Tk()

root.wm_iconphoto(#something)

root_2.wm_iconphoto(#same or another thing)
#Error

when i try set iconphoto for the second Tk window it returns this error:

Traceback (most recent call last):
  File "C:\Users\lenovo\AppData\Local\Programs\Python\Python311\Lib\tkinter\__init__.py", line 1948, in __call__    
    return self.func(*args)
           ^^^^^^^^^^^^^^^^
  File "c:\Users\lenovo\Desktop\clauth.py", line 41, in a91
    b02.wm_iconphoto(False,b52)
  File "C:\Users\lenovo\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 "pyimage1" as iconphoto: not a photo image
  • 1
    When calling `PhotoImage(...)` add `master = root` or `master=root_2` respectively. Also read [this](https://stackoverflow.com/q/48045401/11106801). – TheLizzard Jan 18 '23 at 12:58

0 Answers0