Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- class Application(tk.Frame):
- def __init__(self, master=None): # Моля за обяснение, защо self не е повече метод, а променлива? Къде бъркам?
- super().__init__(master)
- self.pack()
- self.create_widgets()
- def create_widgets(self):
- # create widgets
- self.firstNumberEntry = tk.Entry()
- self.plusSigh = tk.Label(text="+")
- self.secondNumberEntry = tk.Entry()
- self.equalSign = tk.Label(text="=")
- self.resultLabel = tk.Label(text="Result...", bg="green", fg="white")
- self.calculateButton = tk.Button(text="Calculate")
- # place widgets
- self.firstNumberEntry.pack(side="left")
- self.plusSigh.pack(side="left")
- self.secondNumberEntry.pack(side="left")
- self.equalSign.pack(side="left")
- self.resultLabel.pack(side="left")
- self.calculateButton.pack(side="left")
- # create the application
- app = Application()
- app.master.title("Sumator")
- app.master.minsize(width=100, height=50)
- # start the program
- app.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement