Guest User

tkinter

a guest
May 30th, 2013
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.32 KB | None | 0 0
  1. class GUI:
  2.  
  3.     def __init__(self, master):
  4.  
  5.         frame = Frame(master)
  6.         frame.pack()
  7.         wat = BooleanVar()
  8.         eng = BooleanVar()
  9.         text = StringVar()
  10.  
  11.         self.inputText = Entry(frame, textvariable=text, width=25)
  12.         self.inputText.pack(pady=5)
  13.         self.watCheckButton = Checkbutton(frame, text="Check WAT Data?", variable=wat)
  14.         self.watCheckButton.pack()
  15.         self.engCheckButton = Checkbutton(frame, text="Engineering Data?", variable=eng)
  16.         self.engCheckButton.pack()
  17.        
  18.         def execute():
  19.             try:
  20.                 #text = self.inputText.get()
  21.                 func(text)
  22.                 print('wat is '+str(wat==True)+' eng is '+str(eng==True))
  23.                 master.destroy()
  24.             except:
  25.                 print('problem here')
  26.    
  27.         def cancel():
  28.             master.destroy()
  29.  
  30.         self.button = Button(frame, text="OK", command=execute, width=10)
  31.         self.button.pack(side=LEFT,padx=5, pady=5)
  32.         self.button = Button(frame, text="Cancel", command=cancel, width=10)
  33.         self.button.pack(side=RIGHT,padx=5, pady=5)
  34.        
  35.         def autocapitalize(*arg):
  36.             text.set(text.get().capitalize())
  37.         text.trace("w", autocapitalize)
  38.    
  39.        
  40. root = Tk()  
  41. gui = GUI(root)
  42. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment