Re: Tkinter
- From: "Fredrik Lundh" <fredrik@xxxxxxxxxxxxxx>
- Date: Sun, 9 Apr 2006 08:35:05 +0200
"Jay" <first180@xxxxxxxxx> wrote:
Cold somebody please enlighten me at why code 1 works perfectly and yet
code to will not display the gif file.
code 2
-----------START---------
from Tkinter import *
class App:
def __init__(self, root):
self.MainFrame = Canvas(root)
self.MainFrame.pack(fill=BOTH, expand=1)
BackgroundFile = PhotoImage(file="Background.GIF")
Tank1 = self.MainFrame.create_image(0, 0, image=BackgroundFile)
root = Tk()
app = App(root)
root.mainloop()
-----------END---------
Thanks
you need to keep a reference to the photo object on the Python side
of things, to keep it from being garbage collected.
see the note at the bottom of this page:
http://www.effbot.org/tkinterbook/photoimage.htm
</F>
.
- Follow-Ups:
- Re: Tkinter
- From: Jay
- Re: Tkinter
- References:
- Tkinter
- From: Jay
- Tkinter
- Prev by Date: Re: how to print without blank?
- Next by Date: Re: More pythonic circle?
- Previous by thread: Re: Tkinter
- Next by thread: Re: Tkinter
- Index(es):
Relevant Pages
|