Tkinter

Jay first180 at gmail.com
Sat Apr 8 19:23:02 EDT 2006


Cold somebody please enlighten me at why code 1 works perfectly and yet
code to will not display the gif file.

code 1
-----------START---------

from Tkinter import *

root = Tk()

MainFrame = Canvas(root)
MainFrame.pack()

BackgroundFile = PhotoImage(file="Background.GIF")
Background = MainFrame.create_image(0, 0, image=BackgroundFile)

root.mainloop()

-----------END---------

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 

Jay




More information about the Python-list mailing list