I am just learning to use Tkinter and am having problems displaying image
files. I am able to display an image using tutorials (such as
http://www.daniweb.com/code/snippet296.html) But when I try my own code all
I get is an empty widget. What is wrong with the following program?
from Tkinter import *
class Foo(Frame):
def __init__(self,m aster=None):
Frame.__init__( self,master)
self.pack()
self.createWidg ets()
def createWidgets(s elf):
self.qbutton = Button(self)
self.qbutton["text"] = "Quit"
self.qbutton["command"] = self.quit
self.qbutton.pa ck(side = "top")
idata =
PhotoImage(file ="/home/sj/documents/projects/xaed/images/cat_001.gif")
canvas = Canvas(width=30 0,height=200)
canvas.pack(sid e="top",fill=BO TH,expand=YES)
canvas.create_i mage(50,10,imag e=idata,anchor= NW)
## lab = Label(self,imag e=idata)
## lab.pack(side=T OP)
root = Tk()
app = Foo(root)
app.mainloop()
#app.destroy()