title: How to activate tkinter window after destroying the previously one?
body: <p>I need the next <code>tkinter</code> window to become active automatically after destroying the previous one.</p>
  
  <p>I'm working with <code>Python 3</code> in <code>Windows 10</code>. </p>
  
  <pre><code>import sys
  from tkinter import *
  
  #Green button pressed
  def passed():
      fails='0'
      with open("ButtonPressed.txt",'w')as TestResult:
          TestResult.write(fails)
      TestResult.close()
      root.destroy()
  
  #Red button pressed
  def failed():
      fails='1'
      with open("ButtonPressed.txt",'w')as TestResult:
          TestResult.write(fails)
      TestResult.close()
      root.destroy()
  
  #First window
  def PushHold(UUT):
      global root
      root = Tk()   
      root.bind('&lt;Return&gt;', lambda q:passed())
      TitleText="Push Button test"
      root.title(TitleText)
      root.geometry("460x160")
      frame = Frame(root)
      frame.pack()
      bottomframe = Frame(root)
      bottomframe.pack( side = BOTTOM )
  
      LABLE_TEXT = "Push and hold S1 on "+ UUT+" board.\n Click OK."
      label = Label( frame, text=LABLE_TEXT)
      label.config(font=("Arial", 22))
      label.pack( side = TOP)
  
      greenbutton = Button(frame, text="OK", bg="Green", fg="White", height=2 , width = 10 , command=lambda: passed())
      greenbutton.config(font=("Arial", 18))
      greenbutton.pack( side = LEFT, padx=140)
      root.mainloop()
  
  #Second window
  def Release(UUT):
      global root
      root = Tk()
      root.bind('&lt;Return&gt;', lambda q:passed())
      TitleText="Release Button test"
      root.title(TitleText)
      root.geometry("460x160")
      frame = Frame(root)
      frame.pack()
      bottomframe = Frame(root)
      bottomframe.pack( side = BOTTOM )
  
      LABLE_TEXT = "Release S1 on "+ UUT+" board.\n Click OK."
      label = Label( frame, text=LABLE_TEXT)
      label.config(font=("Arial", 22))
      label.pack( side = TOP)
  
      greenbutton = Button(frame, text="OK", bg="Green", fg="White", height=2 , width = 10 , command=lambda: passed())
      greenbutton.config(font=("Arial", 18))
      greenbutton.pack( side = LEFT, padx=140)
      root.mainloop()
  
  #read results of the first window
  def PushButton(UUT):
      PushHold(UUT)
      with open("ButtonPressed.txt",'r') as TestResult:
          str = list(TestResult)
          fails = int(str[0]) 
      TestResult.close()
      return fails
  
  #read results of the second window
  def ReleaseButton(UUT):
      Release(UUT)
      with open("ButtonPressed.txt",'r') as TestResult:
          str = list(TestResult)
          fails = int(str[0]) 
      TestResult.close()
      return fails
  
  PushButton('UUT1')    #first window calling
  ReleaseButton('UUT1')    #second window calling
  </code></pre>
  
  <p>The first window is working good, the second window appears, but not active. It is necessary to click on it to activate before pressing the button.</p>
  
  <p>Trials to use <code>root.withdraw()</code> or <code>root.lift()</code> did not succeed.</p>