Zibably
Evgeniy   Liverpool, United Kingdom (Great Britain)
 
 
from tkinter import *


class Main(Frame):
def __init__(self, root):
super(Main, self).__init__(root)
self.build()

def build(self):
self.formula = "0"
self.lbl = Label(text=self.formula, font=("Times New Roman", 21, "bold"), bg="#000", foreground="#FFF")
self.lbl.place(x=11, y=50)

btns = [
"C", "DEL", "*", "=",
"1", "2", "3", "/",
"4", "5", "6", "+",
"7", "8", "9", "-",
"(", "0", ")", "X^2"
]

x = 10
y = 140
for bt in btns:
com = lambda x=bt: self.logicalc(x)
Button(text=bt, bg="#FFF",
font=("Times New Roman", 15),
command=com).place(x=x, y=y,
width=115,
height=79)
x += 117
if x > 400:
x = 10
y += 81

def logicalc(self, operation):
if operation == "C":
self.formula = ""
elif operation == "DEL":
self.formula = self.formula[0:-1]
elif operation == "X^2":
self.formula = str((eval(self.formula))**2)
elif operation == "=":
self.formula = str(eval(self.formula))
else:
if self.formula == "0":
self.formula = ""
self.formula += operation
self.update()

def update(self):
if self.formula == "":
self.formula = "0"
self.lbl.configure(text=self.formula)


if __name__ == '__main__':
root = Tk()
root["bg"] = "#000"
root.geometry("485x550+200+200")
root.title("Калькулятор")
root.resizable(False, False)
app = Main(root)
app.pack()
root.mainloop()
Currently Offline
Recent Activity
888 hrs on record
last played on 18 Apr
20 hrs on record
last played on 18 Apr
35 hrs on record
last played on 18 Apr
yashitory 10 Apr @ 11:38am 
пишу это всем кто в друзьях : заберите хлам из моего инвентаря https://steamcommunity.com/tradeoffer/new/?partner=1246714181&token=4U2gmwG9
Take the trash out of my inventory https://steamcommunity.com/tradeoffer/new/?partner=1246714181&token=4U2gmwG9
Alona 4 Apr @ 5:38am 
+rep played with u, accept my req pls
电动玩具 听你指挥
vvv99 2 Apr @ 4:50pm 
+ rep
Arakus ×͜× 2 Apr @ 3:35pm 
+rep pretty good player
sysseon 2 Apr @ 12:24pm 
+rep winning eco