-
Notifications
You must be signed in to change notification settings - Fork 0
/
Calculator.py
35 lines (24 loc) · 1.25 KB
/
Calculator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from tkinter import *
root = Tk()
root.title = "Calculator"
root.resizable(0, 0)
class Application(Frame):
def __init__(self, master, *args, **kwargs):
Frame.__init__(self, master, *args, **kwargs)
self.createWidgets()
def createWidgets(self):
self.display = Entry(self, font=("Helvetica", 16), relief=RAISED, justify=RIGHT)
self.display.insert(0, "0")
self.display.grid(row=0, column=0, columnspan=5)
self.sevenButton = Button(self, font=("Helvetica", 11), text="7", borderwidth=1)
self.sevenButton.grid(row=1, column=0, sticky="NWNESWSE")
self.eightButton = Button(self, font=("Helvetica", 11), text="8", borderwidth=1)
self.eightButton.grid(row=1, column=1, sticky="NWNESWSE")
self.nineButton = Button(self, font=("Helvetica", 11), text="9", borderwidth=1)
self.nineButton.grid(row=1, column=2, sticky="NWNESWSE")
self.timesButton = Button(self, font=("Helvetica", 11), text="*", borderwidth=1)
self.timesButton.grid(row=1, column=3, sticky="NWNESWSE")
self.clearButton = Button(self, font=("Helvetica", 11), text="C", borderwidth=1)
self.clearButton.grid(row=1, column=4, sticky="NWNESWSE")
app = Application(root).grid()
root.mainloop()