experiments

All kinds of coding experiments
Log | Files | Refs | Submodules

tkinter_tutorial_8.py (506B)


      1 from Tkinter import *
      2 
      3 class VHButtons:
      4     def __init__(self, master): # This is a constructor
      5 		frame = Frame(master)
      6 		frame.pack()
      7 		
      8 		self.printButton = Button(frame, text="Print message", command = self.printMessage)
      9 		self.printButton.pack(side=LEFT)
     10 		
     11 		self.quitButton = Button(frame, text="Quit", command=frame.quit)
     12 		self.quitButton.pack(side=LEFT)
     13 		
     14     def printMessage(self):
     15 	    print 'Wow, it actually worked!'
     16 		
     17 
     18 root = Tk()
     19 
     20 b = VHButtons(root)
     21 
     22 root.mainloop()