Disable Tkinter Button While Executing Command
I want to disable tk inter button when executing command and enable it back once the command execution finished. I have tried this code, but it seems not working. from Tkinter impo
Solution 1:
Use pack_forget() to disable and pack() to re-enable. This causes "pack" window manager to temporarily "forget" it has a button until you call pack again.
from Tkinter import *
import time
top = Tk()
defRun(object):
object.pack_forget()
print'test'
time.sleep(5)
object.pack()
b1 = Button(top, text = 'RUN', command = lambda : Run(b1))
b1.pack()
top.mainloop()
Post a Comment for "Disable Tkinter Button While Executing Command"