Newbie: question about Tkinter

Locash built4living at
Fri Feb 28 18:33:36 CET 2003


I am a recreational programmer who has decided to give Python a try. 
Up until this point, I have always managed to find a resource that
would help me out when I got into trouble, but not this time.  I
recently turned my attention towards tkinter, and I am afraid I am
stumped.  I just want to know how to put an image on a canvas.  I am
sure I am missing something simple, but can someone help me out?  TIA.

This is what I have:


from Tkinter import *

class Application(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
    def createWidgets(self):
        img = PhotoImage(file='test.gif')
        self.canvas = Canvas(self, height=200, width=300, bg='white')
        self.canvas.create_image (10, 10, image=img)
app = Application() 



When I run this, I get the frame and the canvas, but nothing on it. 
What am I missing?


More information about the Python-list mailing list