newbie problem with canvas create_image
John Boik
johnboik at sbcglobal.net
Wed Jul 3 01:39:21 EDT 2002
Hi:
Im having a problem that I just cant figure out. I am trying to create a
simple program that has a gif in a canvas on a frame. I imported Tkinter
and Image, created the frame for the widget and then have:
photo=Image.open("name.gif")
photo2=photo.rotate(10)
photo2.show()
cnv= Canvas(pane.pane("right"))
cnv.create_image(5,50,anchor=SW, image=photo)
cnv.pack()
For this code I get the following message:
Traceback (most recent call last):
File "C:\Python22\digitizer.py", line 33, in ?
cnv.create_image(5,50,anchor=SW, image=photo)
File "C:\Python22\lib\lib-tk\Tkinter.py", line 1949, in create_image
return self._create('image', args, kw)
File "C:\Python22\lib\lib-tk\Tkinter.py", line 1939, in _create
(self._w, 'create', itemType)
TclError: image "<GifImagePlugin.GifImageFile instance at 0x0135A520>"
doesn't exist
I would think that Image is imported OK because I do get the rotated image
shown in a frame. But for some reason, create_image does not work. It did
work, however, when I used it with:
photo= PhotoImage("name.gif")
but I would rather use Image.open because I want to use the rotate and
resize commands. Any idea why create_image would not work?
Thanks. John
More information about the Python-list
mailing list