Newbie needs help with canvas.create_image !
Fredrik Lundh
fredrik at pythonware.com
Sat Feb 12 12:24:11 EST 2005
Antti Isomursu wrote:
> With code below I get a red box with given width and height. When I
> use that create_image, nothing happens. I only see that same red box.
> Why is that?
> The loop.bmp is working fine when I use show() method.
>
> win = Toplevel()
>
> canvas = Canvas(win, width=100, height=100, background='red')
> canvas.pack()
>
> im = Image.open("loop.bmp")
> photo = ImageTk.PhotoImage(im)
>
> canvas.create_image(8, 8, anchor="nw", image=photo)
the problem might be that the PhotoImage is garbage collected before being
displayed. see the note on the bottom of this page for details:
http://effbot.org/zone/tkinter-photoimage.htm
</F>
More information about the Python-list
mailing list