【发布时间】:2019-04-18 17:03:08
【问题描述】:
Python 3 非常新,我在 tkinter 中编写了我的第一个应用程序。
当凭证(编号)超出范围、最大值和最小值时,我有一个 if 创建标签,但是如果我首先在范围之外运行然后更改我的编号,我想在我的开头删除标签其他代码。
我尝试过使用Label.delete、Label.destroy,但只会抛出错误。
if int(voucher.get()) > int(maxN):
textbox.configure(state="normal")
textbox.delete('1.0', END)
textbox.update()
Label(root, text="The voucher " + str(voucher.get()) + " number is outside of valid range").place(x=200, y=175)
textbox.configure(state="disabled")
elif int(voucher.get()) < int(minN):
textbox.configure(state="normal")
textbox.delete('1.0', END)
textbox.update()
Label(root, text="The voucher " + str(voucher.get()) + " number is outside of valid range").place(x=200, y=175)
textbox.configure(state="disabled")
else:
# I want to destroy Label here
textbox.configure(state="normal")
Label(root, text="All well")
感谢任何帮助。
//弗雷德
【问题讨论】:
标签: tkinter label python-3.7