0

So I'm making a toplevel window and when I try to insert an image using PhotoImage and file it says "couldn't recognize data in image file" My image is in .gif and I'm sure the location is right. In fact it doesn't even recognize the images I use for iconbitmap. either

Does someone know what the problem might be??

ventanagrupo= Toplevel()
    ventanagrupo.geometry("800x500")
    ventanagrupo.title("GF")
    ventanagrupo.config(bg="#22333B")
    bandname=Label(ventanagrupo, text="BABYMETAL", bg="#22333B", fg="#F4ECD6",compound="bottom", font="Helvetica 20 bold").place(x="330", y="10")
    babymetal= PhotoImage(file="/Users/FabianaZamora/Desktop/Tarea Interfaz 2.0/babymetal3.gif")
    babymetallabel=Label(ventanagrupo, image=babymetal).place(x="330", y="60")

I've tried resizing the image and using different images, also moving the image to different folders and writing the right locations but nothing works... Does someone know what the problem might be??

  • uff, that Tkinter PhotoImage thing seems to be *ancient*; maybe it simply doesn't support your file. Use something less archaic, maybe? – Marcus Müller Apr 04 '22 at 16:58
  • Try saving the PhotoImage to a variable, if memory serves right using it directly might result in the picture being garbage collected. https://stackoverflow.com/questions/27430648/tkinter-vanishing-photoimage-issue – Talon Apr 04 '22 at 16:59
  • I saved the image differently and it worked thank you so much :) – fabieds Apr 05 '22 at 17:30

0 Answers0