【发布时间】:2022-08-18 22:10:56
【问题描述】:
我目前正在使用 tkinter 构建一个 GUI,我希望通过按钮实现的功能之一是它是否可以在单击时被破坏。我尝试了一些类似的东西:
button = Button(window, text=\"hello\", command=button.destroy()
这不起作用,因为我收到错误:
UnboundLocalError: local variable \'button\' referenced before assignment.
是否有解决方法来完成这样的任务?