import tk
import customtk as ck
window = tk.Tk()
strvar = tk.StringVar()
def set_num(number):
strvar.set(strvar.get()+number)
def clear_num():
strvar.set("")
def calnumber():
javab = str(eval(strvar.get()))
strvar.set(javab)
def menu():
window = tk.Tk()
tk.Label(window, text="ساخته شده توسط آقا رضا", fg="black").place(x=50, y=100, width=150, height=31)
hj = 2
def clooose():
while hj == 2:
break
window.title("about us")
tk.Button(window, text="باشه", fg="black", command=clooose).place(x=90, y=130)
window.minsize(260, 260)
window.maxsize(260, 260)
window.mainloop()
tk.Canvas(window, bg="white").place(x=0, y=0, height=800, width=600)
tk.Canvas(window,border=0, background="#272121").place(x=0, y=0, width=500, height=600)
tk.Button(window, text="0", border=0, foreground="white", background="#443737", command=lambda:set_num("0")).place(x=4, y=297, height=50, width=136)
tk.Button(window, text=".", border=0, foreground="white",background="#443737", command=lambda:set_num(".")).place(x=142, y=297, height=50, width=67)
tk.Button(window, text="1", border=0, foreground="white", bg="#443737", command=lambda:set_num("1")).place(x=4, y=244, height=50, width=67)
tk.Button(window, text="2", border=0, foreground="white", bg="#443737", command=lambda:set_num("2")).place(x=73, y=244, height=50, width=67)
tk.Button(window, text="3", border=0, foreground="white", bg="#443737", command=lambda:set_num("3")).place(x=142, y=244, height=50, width=67)
tk.Button(window, text="4", border=0, foreground="white", bg="#443737", command=lambda:set_num("4")).place(x=4, y=191, height=50, width=67)
tk.Button(window, text="5", border=0, foreground="white", bg="#443737", command=lambda:set_num("5")).place(x=73, y=191, height=50, width=67)
tk.Button(window, text="6", border=0, foreground="white", bg="#443737", command=lambda:set_num("6")).place(x=142, y=191, height=50, width=67)
tk.Button(window, text="7", border=0, foreground="white", bg="#443737", command=lambda:set_num("7")).place(x=4, y=139, height=50, width=67)
tk.Button(window, text="8", border=0, foreground="white", bg="#443737", command=lambda:set_num("8")).place(x=73, y=139, height=50, width=67)
tk.Button(window, text="9", border=0, foreground="white", bg="#443737", command=lambda:set_num("9")).place(x=142, y=139, height=50, width=67)
tk.Button(window, text="=", border=0,command=calnumber, font=("arial", (20)), foreground="black", bg="#E3651D").place(x=211, y=297, height=50, width=62)
tk.Button(window, text="+", border=0, font=("arial", (20)), foreground="green", bg="#233737", command=lambda:set_num("+")).place(x=211, y=244, height=50, width=62)
tk.Button(window, text="-", border=0, font=("arial", (20)), foreground="red", bg="#233737", command=lambda:set_num("-")).place(x=211, y=191, height=50, width=62)
tk.Button(window, text="×", border=0, font=("arial", (20)), foreground="yellow", bg="#233737", command=lambda:set_num("*")).place(x=211, y=139, height=50, width=62)
tk.Entry(window, border=0,textvariable=strvar, bg="#272121", fg="white", font=("tahoma", (30)) ).place(x=15, y=50, width=240, height=50)
threeline = tk.PhotoImage(file="3line.png")
tk.Button(window, image=threeline,command=menu, border=0, bg="#272121").place(x=5, y=5, width=40, height=40)
tk.Button(window, text="c", fg="white", border=0, bg="#272121", command=clear_num).place(x=5, y=98, width=40, height=40)
tavan = tk.PhotoImage(file="X-TN2.PNG")
tk.Button(window, image=tavan, border=0, bg="#272121",fg="white", command=lambda: set_num("**2")).place(x=130, y=98, width=40, height=40)
darsad = tk.PhotoImage("Darsad.png")
tk.Button(window, text="%", border=0, bg="#272121",fg="white", command=lambda: set_num("/100")).place(x=90, y=98, width=40, height=40)
tk.Button(window, text="÷", border=0, bg="#272121",fg="white", command=lambda:set_num("/")).place(x=50, y=98, width=40, height=40)
tk.Label(window, text="calculator",bg="#272121", fg="white", font=("tahoma", (15))).place(x=160, y=10)
window.title("calculator")
window.minsize(270,350)
window.maxsize(270,350)
window.mainloop()