Cannot Display an Image in Tkinter [duplicate]

Ok, I figured It out. Apparently due to the way that python deals with garbage disposal the pictures just get erased. A reference to the image in the global scope is required. This is the working code I eventually ended up using:

self.photo = PhotoImage(file="noart.ppm")
    self.Artwork = Label(self.frame, image=self.photo)
    self.Artwork.photo = self.photo
    self.Artwork.pack()

that self.Artwork.photo = self.photo is the important part. It ensures that the Image will be shown.

Leave a Comment