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 10 # this line turns off the recalculation of geometry by masters. 11 self.Gpanel.propagate(0) 12 13 self.Gpanel.pack(side=LEFT) 14 15 # a QUIT button 16 self.Gpanel.QUIT = Button(self.Gpanel, text='QUIT', foreground='red', 17 command=self.quit) 18 self.Gpanel.QUIT.pack(side=LEFT) 19 20 def __init__(self, master=None): 21 Frame.__init__(self, master) 22 Pack.config(self) 23 self.createWidgets() 24 25test = Test() 26 27test.master.title('packer demo') 28test.master.iconname('packer') 29 30test.mainloop() 31