【发布时间】:2019-02-26 14:14:17
【问题描述】:
这是我的入口小部件和按钮点击代码
# Amount entry here
textBoxAmount = Entry(win, textvariable=amount_entry)
textBoxAmount.grid(row=2, column=1)
# Deposit button here
buttonDeposit = tk.Button(text="Deposit", command=perform_deposit())
buttonDeposit.grid(row=2, column=2)
&我的函数 perform_deposit
def perform_deposit():
'''Function to add a deposit for the amount in the amount entry to the
account's transaction list.'''
global account
global amount_entry
global balance_label
global balance_var
# Try to increase the account balance and append the deposit to the account file
#input = amount_text.get("1.0",END)
amount_entered = amount_entry.get()
print("amount entered : {}".format(amount_entry.get()))
print(amount_entered)
#balance_var= account.deposit(amount_entry.get())
print(balance_var)
输出是这样的
amount entered :
在文本小部件中放入 200 时没有获得 textvariable 值
【问题讨论】: