gif format for PhotoImage

Dr. David J. Ritchie, Sr. djrassoc01 at mindspring.com
Thu Feb 14 22:35:04 EST 2002


Is the gif format expected by PhotoImage different from the gif format
generated by something like GifConverter, for example?

In the example below (in which I have removed some things but
hopefully not broken anything of relevance to this question), I find that
some things I think of
as "gif" images on my system display fine while others are just black
or a series of dots (but they display fine with Netscape).

Can anyone give me some pointers to where I might find a discussion
of the gif format expected?

Thanks.

--David

---------------

# Tk Text Example

from Tkinter import *
root = Tk()
root.title("My Toplevel")

# Text
# A top level window
wTL2 = Toplevel(root, bg='brown')

# Put a Text widet named text in it with a vertical scroll bar.
text = Text(wTL2, height=30, width=50)
scroll= Scrollbar(wTL2, command=text.yview)
text.configure(yscrollcommand=scroll.set)

# define a picture and specify where it is to go
photo=PhotoImage(file='Picture.gif')
photo.configure(width=50, height=50)
text.image_create(END, image=photo)

# arrange the text window to the left and the scroll bar to the right
text.pack(side=LEFT)
scroll.pack(side=RIGHT, fill=Y)

# Putting Tk into Operation
# Turn over control to Tk so that it can respond
# to mouse clicks and keyboard activity which then
# causes it to call your program's code via call backs.

root.mainloop()
print "Goodbye!"

--
Dr. David J. Ritchie, Sr.
djrassoc01 at mindspring.com
http://home.mindspring.com/~djrassoc01/





More information about the Python-list mailing list