Home | History | Annotate | Download | only in matt
      1 from Tkinter import *
      2 
      3 
      4 class Test(Frame):
      5     def printit(self):
      6         print self.hi_there["command"]
      7 
      8     def createWidgets(self):
      9         # a hello button
     10         self.QUIT = Button(self, text='QUIT', foreground='red',
     11                            command=self.quit)
     12         self.QUIT.pack(side=LEFT, fill=BOTH)
     13 
     14         self.hi_there = Button(self, text='Hello',
     15                                command=self.printit)
     16         self.hi_there.pack(side=LEFT)
     17 
     18         # note how Packer defaults to side=TOP
     19 
     20         self.guy2 = Button(self, text='button 2')
     21         self.guy2.pack()
     22 
     23         self.guy3 = Button(self, text='button 3')
     24         self.guy3.pack()
     25 
     26     def __init__(self, master=None):
     27         Frame.__init__(self, master)
     28         Pack.config(self)
     29         self.createWidgets()
     30 
     31 test = Test()
     32 test.mainloop()
     33