python tinter gui中的输出变量不输出值

时间:2018-08-12 09:59:31

标签: python

我制作了一个程序,可以将您要订购的饮料加在一起,并计算最终税额。但是最终总数输出不正确。

我很新,不知道我是否读得对,但我认为这使OverAllCost成为饮料,税收和折扣的总和。然后将总数增加或减少(必须使其为浮点值乘以1.05),然后将其分配给变量total。然后,总计将显示在标签中。

costoforder = "$",str('%.2f'% (costofcappacuino +  costoflatte +   costofflatwhite + costofblackcoffee + costofamericano + costoffrappe))

PayTax=((costofcappacuino +  costoflatte + costofflatwhite + costofblackcoffee +  costofamericano + costoffrappe)*0.15)

Totalcost=(costofcappacuino +  costoflatte + costofflatwhite + costofblackcoffee  + costofamericano + costoffrappe)

Disscount=((costofcappacuino +  costoflatte + costofflatwhite + costofblackcoffee + costofamericano + costoffrappe)*0.10)

OverAllCost=int( PayTax + Totalcost - Disscount) 
if OverAllCost >= 12: 
    OverAllCost="$"+str( PayTax + Totalcost - Disscount) 
else:
    OverAllCost="$"+str( PayTax + Totalcost)
Disscounts="$"+str('%.2f'% Disscount)   
PaidTax=' $%.2f' % PayTax
Total = float()
if Takeaway == 'Yes' or 'yes' or 'y' or 'Y':
    OverAllCost=Total*1.05

Total = StringVar()
Disscount = StringVar()

Disscount.set(Disscounts)
cost.set(costoforder)
Tax.set(PaidTax)
Subtotal.set(costoforder)
Total.set(OverAllCost)
FinalTotal.set(Total)
FinalDiscount.set(Disscounts)

rand = StringVar()
Cappacuino = StringVar()
Latte = StringVar()
Flat_White = StringVar()
Black_Coffee = StringVar()
Subtotal = StringVar()
Total = StringVar()
Disscount = StringVar()
Frappe = StringVar()
Tax = StringVar()
cost = StringVar()
Americano = StringVar()
FinalDiscount = StringVar()
Takeaway = StringVar()
FinalTotal = StringVar()

lblTotal = Label(f1, font=( 'aria' ,16, 'bold' ),text="Total",fg="steel blue",bd=10,anchor='w')
lblTotal.grid(row=5,column=4)
txtTotal = Entry(f1,font=('ariel' ,16,'bold'), textvariable=FinalTotal , bd=6,insertwidth=4,bg="powder blue" ,justify='right')
txtTotal.grid(row=5,column=5)

但是问题是它显示的是“ PY_VAR15”而不是值,并且没有给出任何其他错误消息。

0 个答案:

没有答案