Guest User

sumator

a guest
Apr 11th, 2019
161
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import tkinter as tk
  2. class Application(tk.Frame):
  3.     def _init_(self, master=None):
  4.         super()._init_(master)
  5.  
  6.         self.pack()
  7. # create the application
  8. app = Application()
  9. app.master.title("Sumator")
  10. app.master.minsize(width=100, height=50)
  11.  
  12. # start the program
  13. app.mainloop()
  14. def _init_(self, master=None):
  15.     super()._init_(master)
  16.     self.pack()
  17.     self.create_widgets()
  18. def create_widgets(self):
  19.     # create widgets
  20.     self.firstNumberEntry = tk.Entry()
  21.     self.plusSign = tk.Label(text="+")
  22.     self.secondNumberEntry = tk.Entry()
  23.     self.equalSign = tk.Label(text="=")
  24.     self.resultLabel = tk.Label(text="Result...", bg="green", fg="white")
  25.     self.calculateButton = tk.Button(text="Calculate")
  26.     # place widgets
  27.     self.firstNumberEntry.pack(side="left")
  28.     self.plusSign.pack(side="left")
  29.     self.secondNumberEntry.pack(side="left")
  30.     self.equalSign.pack(side="left")
  31.     self.resultLabel.pack(side="left")
  32.     self.calculateButton.pack(side="left")
RAW Paste Data