我正在尝试制作一个能够显示水泥,砖,扳手,镜子和锤子总库存的程序。但问题请帮帮我 这个程序一直让我看到' cementinVar未定义'但我已将其定义为(cementinVar = Tkinter.IntVar())。
def textboxvalue2():
Total_StockIn = 0
CementIn = cementinVar.get()
HammerIn = hammerinVar.get()
SpannerIn = spannerinVar.get()
BrickIn = brickinVar.get()
MirrorIn = mirrorinVar.get()
CementOut = cementoutVar.get()
HammerOur = hammeroutVar.get()
SpannerOut = spanneroutVar.get()
BrickOut = brickoutVar.get()
MirrorOut = mirroroutVar.get()
Total_StockIn = (CementIn + HammerIn + SpannerIn + BrickIn + MirrorIn)+Total_StockIn
StockInLabel = Tkinter.Label(sub,text='The total stock in is '+str(Total_StockIn))
StockInLabel.grid(row=7, column =2)
答案 0 :(得分:2)
您在另一个范围内定义cementinVar。您有两种可能的解决方案: