title: Dialog using Toplevel windows in Python Tkinter
body: <p>I have written some Tkinter dialogs that are called from within an app running in a mainloop. My dialog initializer usually looks like this:</p>
  
  <pre><code>class OKCANCEL( Toplevel ):
      def __init__( self, parent, title ):
          Toplevel.__init__( self, parent )
          self.parent = parent
          self.title( title )
  ...
  </code></pre>
  
  <p>I call this from within my app as:</p>
  
  <pre><code>o = OKCANCEL( self.mainWindow, mtext = QUIT_REALLY )
  </code></pre>
  
  <p>where <code>self.mainWindow</code>is a Frame within my App window (a class inheriting from Frame).
  Now, every time that I am calling the dialog, a smaller window appears and <strong>then</strong> the intended window replaces the small one. The display duration is short, however, it is annoying to have this appening.
  Am I missing the obvious?
  Can someone point me to my mistake?</p>
  
  <p>Thanks!</p>
  
  <p>Edit: I just wrote up a small example and tried to reproduced the behaviour, however, either it was not present or it happened too fast. I am kind of confused, the small window that appears even has a window title that is nowhere to be found in the code (the big, huge chunk of code that is not on this page).</p>
  
  <pre><code># -*- coding: UTF-8 -*-
  import os
  from Tkinter import *
  
  class WARNING(Toplevel): #ok only dialog
         def __init__(self,parent,wtext,wtitle=''):
              Toplevel.__init__(self,parent)
              self.parent=parent
              self.protocol("WM_DELETE_WINDOW",self._NULL) #we need to include a check again...
              self.title(wtitle)
              self.attributes('-topmost',True)
              self.transient()
              mainWindow=Frame(self)
              tFrame=Frame(mainWindow)
              tLabel=Label(tFrame,text=wtext,height=3,bd=10)
              tLabel.pack()
              bFrame=Frame(mainWindow,bd=5)
              bOK=Button(bFrame,bd=1,text='Ok',command=self._DONE)
              bOK.pack(side='left')
              tFrame.grid(row=0,column=0)
              bFrame.grid(row=1,column=0,sticky=E)
              mainWindow.pack()
  
          def _DONE(self,Event=None):
              self.destroy()
  
          def _NULL():
              pass
  
      class WarnApp(Frame):
  
          def __init__(self,parent):
              Frame.__init__(self, parent)
              self.parent=parent
              self.initUI()
  
          def initUI(self):
              self.parent.title("Warning test")
              self.mainWindow = Frame(self.parent)
              B1=Button(self.mainWindow,command=self.Warn,text='Warn-Me')
              B1.pack(fill=BOTH)
              self.mainWindow.pack(fill=BOTH)
              self.pack(fill=BOTH)
  
          def Warn(self):
              warn=WARNING(self,wtext='This is a warning',wtitle='generic warning dialog')
              self.wait_window(warn)
  
      def main():
          root=Tk()
          app = WarnApp(root)
          app.mainloop()
  
      if __name__ == "__main__":
          main()
      `
  </code></pre>