TK and PhotoImage: Problem getting image to display

Timothy Grant tjg at avalongroup.net
Wed Feb 23 19:11:58 EST 2000


Hi all,

Just started playing with some of the image aspects of Tkinter, and I
immediately ran into a roadblock. I found a similar problem in the
archives, but I can't get the resolution to work for me. Given the code
below, I successfully create the canvas, but can't for the life of me
figure out how to get my gif to display inside the canvas.

All suggestions greatfully accepted...


from Tkinter import *

class Quoter:
    def __init__(self, master):
        qFrame = Frame(master)
        qFrame.pack(side=TOP)
        
        #qCompanyLogoCanvas =  Canvas(qFrame, width=275, height=50)
        #qCompanyLogoCanvas.pack(side=LEFT)
        
        img = PhotoImage(file='amos3.gif')
        qAMOSLogoCanvas = Canvas(qFrame, width=300, height=300)
        qAMOSLogoCanvas.create_image(0, 0, anchor=NW, image=img)
        qAMOSLogoCanvas.pack()        

if __name__ == '__main__':
    root = Tk()
    Pmw.initialise(root)

    root.title('AMOSoft Quoting')

    quoter = Quoter(root)

    root.mainloop()



-- 
Stand Fast,
    tjg.

Chief Technology Officer              tjg at exceptionalminds.com
Red Hat Certified Engineer            www.exceptionalminds.com
Avalon Technology Group, Inc.                   (503) 246-3630
>>>>>>>>>>>>Linux...Because rebooting isn't normal<<<<<<<<<<<<




More information about the Python-list mailing list