from tkinter import *
win=Tk()
win.title('Калькулятор')
win.geometry('400x500')
win['bg']='#9FEE00'
calc=Entry(width=21, font='Arial 20')
calc.place(x=40,y=40)
def btnc7():
calc.insert(END,'7')
btn7=Button(text='7', command=btnc7,background='#7109AA', foreground='white',width=12)
btn7.place(x=40,y=100)
def btnc8():
calc.insert(END,'8')
btn8=Button(text='8', command=btnc8,background='#7109AA', foreground='white',width=12)
btn8.place(x=140,y=100)
def btnc9():
calc.insert(END,'9')
btn9=Button(text='9', command=btnc9,background='#7109AA', foreground='white',width=12)
btn9.place(x=240,y=100)
def btncp():
calc.insert(END,'+')
btnp=Button(text='+', command=btncp,background='#7109AA', foreground='white',width=12)
btnp.place(x=240,y=300)
def btncc():
calc.delete(0,END)
btnc=Button(text='C', command=btncc,background='#7109AA', foreground='white',width=12)
btnc.place(x=140,y=300)
def btncr():
result=calc.get()
calc.delete(0, END)
calc.insert(END, eval(result))
btnr=Button(text='=', command=btncr,background='#7109AA', foreground='white',width=12)
btnr.place(x=40,y=300)
win.mainloop()