Noam
Noam

Reputation: 3

image "pyimage1" doesn't exist even if master is defined

I made a script with tkinter which worked until I include it into another script. Both are making their own window tkinter and with all I read on this error it seems that the error is because the fact that there are two windows. Furthermore, on all I read, the error was because the master was not defined but in my script it is. Here is the error with the script:

File "C:\Users\Noam\pythonProject1\ui.py", line 95, in afficher_images
    button = tk.Button(master=frame, image=i[1][0])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Noam\AppData\Local\Programs\Python\Python311\Lib\tkinter\__init__.py", line 2706, in __init__
    Widget.__init__(self, master, 'button', cnf, kw)
  File "C:\Users\Noam\AppData\Local\Programs\Python\Python311\Lib\tkinter\__init__.py", line 2628, in __init__
    self.tk.call(
_tkinter.TclError: image "pyimage1" doesn't exist

so my photoimage is located in i[1][0] . I tried to change the code to make the PhotoImage directly by creating the button and it always doesn't work but this time it is pyimage5 and not 1.

Upvotes: 0

Views: 76

Answers (0)

Related Questions