using the 'data' option on the PhotoImage class of Tkinter

Seung Chan Lim slim at maya.com
Wed Nov 8 19:30:40 EST 2000


I'm doing the following to load the binary data of a GIF file and trying to
instantiate
a PhotoImage object using that data through its "data" option, and I'm
having some trouble...

import Tkinter
root=Tk()
f=open("temp.gif","rb")
img=f.read()
pimg=Tkinter.PhotoImage(data=img)


and I get a

TclError: couldn't recognize image data

my GIF file is just a simple gif file saved in Photoshop...

I've also tried using the os module's file I/O to see if there's any
difference...

anybody have experience with this?







More information about the Python-list mailing list