【发布时间】:2020-01-14 19:52:50
【问题描述】:
我刚开始使用 python,但遇到了问题。我尝试了各种解决方案,但无法更新显示“19”的字段。当我点击加号时,我希望它是 20,然后是 21,...当我点击时 - 它必须回到 20、19。谁能告诉我如何解决这个问题?
from tkinter import *
def fct_tempplus():
while True:
# tekstvak_input_user = tekstvak_input_user +1
return tekstvak_input_user + 1
def fct_tempmin():
print ('ok')
window = Tk()
window.geometry("800x400") # not *
window.title("TEST")
label= Label( window, text = "Temp?")
label.place(x=350,y=175)
tempplus=Button(window, bd=10,width=10, height = 1,text="+",command=fct_tempplus,
font=("Helvetica", 12))
tempplus.place(x=500,y=150)
tempmin=Button(window, bd=10,width=10, height = 1,text="-", font=("Helvetica", 12),command=fct_tempmin)
tempmin.place(x=500,y=200)
tekstvak_input_user = Entry(window, width = 10 )
tekstvak_input_user.insert(0,19.0)
tekstvak_input_user.place(x=350 , y=200)
window.mainloop()`
【问题讨论】: