On Wed, Jun 29, 2005 at 09:50:44PM -0700, Todd Lericos wrote:
> I tried many of the suggested fixes. For example, heading off 
> garbage collection of the image...etc. No dice.

I'm pretty sure you didn't "head off garbage collection of the image".
Here's why:  You immediately discard the MakeGui instance you create,
and it is the only thing which holds a reference to the image.  

Perhaps this change will make your program work:
- MakeGui(tooltitle, filedir, filetype, plotelem, filelist)
+ gui = MakeGui(tooltitle, filedir, filetype, plotelem, filelist)

In fact, in the program below, storing the 'App' instance is what makes
the difference between a program that displays an image and one that
doesn't.

Jeff


import Tkinter
class App:
    def __init__(self, t):
        self.i = Tkinter.PhotoImage(file = "example.gif")
        c = Tkinter.Canvas(t, width=16, height=16); c.pack()
        c.create_image(0, 0, image = self.i, anchor=Tkinter.NW)

t = Tkinter.Tk()

# If this line is used, the program does not work
#App(t)

# If this line is used, the program works
a = App(t)

t.mainloop()

Attachment: pgpAwzfO2llhd.pgp
Description: PGP signature

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to