title: Disable Tkinter button while executing command
body: <p>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.</p>
  
  <pre><code>from Tkinter import *
  import time
  
  top = Tk()
  def Run(object):
      object.config(state = 'disabled')
      print 'test'
      time.sleep(5)
      object.config(state = 'normal')
  
  b1 = Button(top, text = 'RUN', command = lambda : Run(b1))
  b1.pack()
  
  top.mainloop()
  </code></pre>
  
  <p>The command execution run well, but every time I click the button when the command is being executed, 'test' appears in the console right after the Run function finished. Which mean the button is not disabled when the Run function is being executed. Any suggestion to fix this problem?</p>
  
  <p>Thanks in advance</p>