Tkinter PhotoImage weirdness

Theodore D. Sternberg strnbrg at c532352-a.frmt1.sfba.home.com
Sat May 12 06:24:15 CEST 2001


Seemingly trivial modifications to the following program
cause the image to appear or, alterately, fail to appear.

As written, only a blank button appears.  But remove the ^#
and instead comment out the line after, and the image (you'll
need to provide your own in a file ColorWheel.ppm) does
appear.

-------------- cut here --------------
from Tkinter import *
root = Tk()
colorwheel = PhotoImage( file="ColorWheel.ppm" )
butt = Button(root,
#           image = PhotoImage( file="ColorWheel.ppm" ))
            image = colorwheel )
butt.pack()
root.mainloop()
-------------- cut here ---------------

I'm stumped; why would this trivial difference matter?

Ted Sternberg
Fremont, CA




More information about the Python-list mailing list