'can't figure out why my entry() widget is returning null
I've been trying to pass data from an entry box inside a function to another function but the entry.get() function seems to be returning nothing. here is a part of my code. thanks guys
def cubedim():
dimensionframeclear()
length = 0.0
length1label = Label(DimensionFrame, text="Length", font=7)
length1label.grid(row=1, column=0)
cubelength = Entry(DimensionFrame, textvariable=length)
cubelength.grid(row=1,column=1, padx=5)
calculatebutton = Button(DimensionFrame, text= "Calculate")
calculatebutton.grid(row=1,column=4)
return length
def totalamount():
if var1.get() == 1:
length = cubedim()
dimensionofgift = length * length
if var5.get() == 1:
paperprice = 0.4
elif var5.get() == 2:
paperprice = 0.75
itembow = int(var3.get())
itemcard = int(var4.get())
characterlength = len(CardMsg.get())
if itembow == 1:
pricebow = 1.5
else:
pricebow = 0
if itemcard == 1:
pricecard = 0.5
else:
pricecard = 0
subtotal = dimensionofgift * paperprice + pricecard + pricebow + (characterlength*0.5)
return subtotal
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
