[Python] tkinter pyimage doesn't exist error when trying to place a photoi in a label

Discussão em 'Python' iniciado por Stack, Janeiro 28, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to show a photo in a label from a URL. It works fine getting the photo from the URL but then when i try to make it on a label is shows _tkinter.TclError: image "pyimage196" doesn't exist This is the code I'm using

    u = urllib.request.urlopen(self.url)
    raw_data = u.read()
    u.close()
    im = Image.open(BytesIO(raw_data))
    photo =ImageTk.PhotoImage(im)
    self.photo = photo
    image_label = tk.Label(infowindow, text="", image=photo)
    image_label.pack()

    Continue reading...

Compartilhe esta Página