Hi,
when I make toolbar in my program, I wrote the following code according with
the Python Cookbook,9.6 Embedding Inline GIFs Using Tkinter.
#!/usr/bin/env python
import base64
import Image
import Tkinter
str = "icon='''\n" + base64.encodestring(open("D:\My Documents\My
Pictures\objects_020.gif").read( )) + "'''"
print str
exec(str)
root = Tkinter.Tk( )
iconImage = Tkinter.PhotoImage(master=root, format="gif", data=icon)
Tkinter.Button(image=iconImage).pack( )
root.mainloop()
I found some gif image would run well with this above codes, but the
others show the following information.
Traceback (most recent call last):
File "gif.py", line 11, in <module>
iconImage = Tkinter.PhotoImage(master=root, format="gif", data=icon)
File "C:\Python26\lib\lib-tk\Tkinter.py", line 3285, in __init__
Image.__init__(self, 'photo', name, cnf, master, **kw)
File "C:\Python26\lib\lib-tk\Tkinter.py", line 3241, in __init__
self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: error reading color map
what am I doing wrong?
Your help will be greatly appreciated,
Gong.
_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss