1from Tkinter import * 2 3 4class Test(Frame): 5 def createWidgets(self): 6 7 self.Gpanel = Frame(self, width='1i', height='1i', 8 background='green') 9 self.Gpanel.pack(side=LEFT) 10 11 # a QUIT button 12 self.Gpanel.QUIT = Button(self.Gpanel, text='QUIT', 13 foreground='red', 14 command=self.quit) 15 self.Gpanel.QUIT.pack(side=LEFT) 16 17 18 def __init__(self, master=None): 19 Frame.__init__(self, master) 20 Pack.config(self) 21 self.createWidgets() 22 23test = Test() 24 25test.master.title('packer demo') 26test.master.iconname('packer') 27 28test.mainloop() 29