From tkinter import* def btn_click():
global y1,y2,y3,y4
y=y1+y2+y3+y4
var5.set(y)
y1=0
y2=0
y3=0
y4=0
def rez(y):
if y==int(y):
return(int(y))
else:
return(y)
tk=Tk()
tk.geometry("440x300")
name=Label(text="Найменування",font=("Aria",12,"bold"))
name.place(x=20,y=20)
price=Label(text="Ціна,грн.",font=("Aria",12,"bold"))
price.place(x=150,y=20)
number=Label(text="Кількість",font=("Aria",12,"bold"))
number.place(x=230,y=20)
cost=Label(text="Вартість,грн",font=("Aria",12,"bold"))
cost.place(x=310,y=20)
pizza=Label(text="Піца",font=("Aria",12))
pizza.place(x=20,y=60)
ice=Label(text="Морозиво",font=("Aria",12))
ice.place(x=20,y=100)
cake=Label(text="Тістечко",font=("Aria",12))
cake.place(x=20,y=140)
juice=Label(text="Сік",font=("Aria",12))
juice.place(x=20,y=180)
vartist=Label(text="Вартість замовлення:",font=("Aria",12))
vartist.place(x=20,y=240)
p1=Entry(font="Aria 12",bg="sky blue",justify="center")
p1.insert(END,"75")
p1.place(x=150,y=60,width=60,height=30)
p2=Entry(font="Aria 12",bg="sky blue",justify="center")
p2.insert(END,"12")
p2.place(x=150,y=100,width=60,height=30)
p3=Entry(font="Aria 12",bg="sky blue",justify="center")
p3.insert(END,"16")
p3.place(x=150,y=140,width=60,height=30)
p4=Entry(font="Aria 12",bg="sky blue",justify="center")
p4.insert(END,"8")
p4.place(x=150,y=180,width=60,height=30)
def s1_click(val):
k1=int(val)
x1=float(p1.get())
y1=x1*k1
var1.set(rez(y1))
s1=Scale(orient=HORIZONTAL,length=50,from_=0,to=10,command=s1_click)
s1.place(x=230,y=50)
def s2_click(val):
k2=int(val)
x2=float(p2.get())
y2=x2*k2
var2.set(rez(y2))
s2=Scale(orient=HORIZONTAL,length=50,from_=0,to=10,command=s2_click)
s2.place(x=230,y=90)
def s3_click(val):
k3=int(val)
x3=float(p3.get())
y3=x3*k3
var3.set(rez(y3))
s3=Scale(orient=HORIZONTAL,length=50,from_=0,to=10,command=s3_click)
s3.place(x=230,y=130)
def s4_click(val):
k4=int(val)
x4=float(p4.get())
y4=x4*k4
var4.set(rez(y4))
s4=Scale(orient=HORIZONTAL,length=50,from_=0,to=10,command=s4_click)
s4.place(x=230,y=170)
var1=StringVar()
c1=Label(text=0,font="Aria 12",bg="#61a1ff",textvariable=var1)
c1.place(x=310,y=60,width=60,height=30)
var2=StringVar()
c2=Label(text=0,font="Aria 12",bg="#61a1ff",textvariable=var2)
c2.place(x=310,y=100,width=60,height=30)
var3=StringVar()
c3=Label(text=0,font="Aria 12",bg="#61a1ff",textvariable=var3)
c3.place(x=310,y=140,width=60,height=30)
var4=StringVar()
c4=Label(text=0,font="Aria 12",bg="#61a1ff",textvariable=var4)
c4.place(x=310,y=180,width=60,height=30)
var5=StringVar()
c5=Label(text=0,font="Aria 12",bg="#61a1ff",textvariable=var5)
c5.place(x=200,y=240,width=60,height=30)
btn=Button(text="Розрахування",font="Aria 12",command=btn_click)
btn.place(x=310,y=240,width=110,height=30)
tk.mainloop()
не считает общую сумму, нужна