views:

28

answers:

1

When I run the program the canvas shows up but the Image does not.

canvas = Canvas(frame, width = 128, height = 128, bg= 'white')
    image_data = Image.open('NoArt.gif')
    ppm_f = ImageTk.PhotoImage(image_data)
    canvas.create_image(0, 0, image = ppm_f, anchor = NW)
    canvas.pack(side=BOTTOM)

any Ideas??

PS.

I have PIL ver 1.6, python 2.6, and The Version of Tkinter that comes with python 2.6

A: 

Ok, I figured It out. Apparently due to the way that python deals with garbage disposal the pictures just get erased. 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 the ensures that the Image will be shown

Joshkunz