title: How to create a custom messagebox using Tkinter in Python with changing message and changing button state
body: <p>I wanted to cerate a message window on top of <code>root window</code> which looks similar from this <a href="http://www.prasannatech.net/2009/05/python-tkinter-tkmessagebox-widget.html" rel="nofollow">link</a>. A message window with a message and an inactive button untill some portion of the code are done and then to display a message with an active button. This is how the code structure looks like(I have cut through specific details to just clear the point how my code flow looks like)</p>
  
  <p>The second window is not working, instead the window appears at the end of the function. Can somebody help.</p>
  
  <pre><code>from Tkinter import *
  import tkMessageBox
  
  def a():
      return
  
  def b():
      . . .
      . . .
      msg_window = Toplevel()
      msg_window.grapset()
      msg_window.title( ___ )
      msg_geometry( ___ )
      msgLabel = Label(window)
      msgLabel["text"]="Processing...."
      msgLabel.pack()
      btn = Button(msg_window, text="Ok", command=msg_window.destroy())
      btn.pack()
      btn.config(state=DISABLED)
      a()
      c()
      d()
      d()
      msgLabel["text"]="Done"
      msgLabel.pack()
      btn = Button(msg_window, text="Ok", command=msg_window.destroy())
      btn.pack()
      btn.config(state=NORMAL)
      e()
      if tkMessageBox.askyesno( ___ ):
          do something
      else:
          do something
      pass
  
  def c():
      return
  
  def d():
      return
  
  def e():
      return
  
  root = Tk()
  frame = Frame( ___ )
  frame.pack()
  but_find = Button( ___ )
  but_find.pack()
  but_start = Button( ___ )
  but_start.pack()
  but_exit = Button( ___ )
  but_exit.pack()
  root.mainloop()
  </code></pre>
  
  <p><strong>Explanation:</strong>
  I am building an application where the root window contains 3 buttons. When <code>start</code> button is clicked, <code>function b</code> is called, which in turn calls various other functions inside <code>function b</code> itself. This is the point where, i want to create a second window that shows up above the root window and making the root window inactive until <code>function b</code> gets completed or until the <code>second window</code> is destroyed.</p>
  
  <p><strong>What i want is..</strong>
  The second window(contains 2 things- a message and a button) should start inside the <code>function b</code> after some steps. It should display the message <code>Processing....</code> and an <code>inactive button</code> called <code>Ok</code> before <code>function a</code> starts and should appear until <code>function d</code> gets completed. Then, i want to display <code>Done</code> with an <code>active 'Ok' button</code> that destroys the second window. Then make the <code>root</code> window active.  </p>