我正在使用python GUI(TK)。我有一个运行很长程序的按钮 - 但我希望在点击它之后立即禁用它。 它看起来像这样:使用Tk按钮的Python
button = tk.Button(self, text="blabla", command= lambda: self.foo(param, button)
def foo(self, button):
button.configure (state = "disabled")
#now call the function that takes time
goo()
def goo():
doLongAction()
问题是按钮仅咕后禁用()返回,接着foo的回报。 有没有办法立即禁用它? 感谢
您应该解决您的压痕,以便更容易看到发生了什么事情。 – Brionius
我编辑它,所以它会更容易理解 – user2950329