I know that this question has already been asked several times, but I still couldn\'t figure out the answer to my problem. I keep getting the same error and don\'t know how
You should use PhotoImage
instance as image
value. Also, you need to keep the reference of your image.
im = Image.open(pathToImage)
ph = ImageTk.PhotoImage(im)
label = Label(window, image=ph)
label.image=ph #need to keep the reference of your image to avoid garbage collection
It seems to be an Anaconda - Spyder - Iphyton problem. Solution is here: _tkinter.TclError: image "pyimage" doesn't exist
A quick hacky fix is to provide the PhotoImage with the correct master:
i = ImageTk.PhotoImage(pathToImage, master=window)