title: Why tkinter toplevel can't be created repeatedly inside a loop in Python3?
body: <p>I want the program to:</p>
  
  <ol>
  <li>make the root window to remain open</li>
  <li>and when the button is clicked it will open a toplevel window</li>
  <li>In the toplevel window when next is clicked, it will destroy that
  toplevel window and create another toplevel window and this will go
  on until the all the elements of the List will be iterated through</li>
  </ol>
  
  <p>But it is not working as expected.</p>
  
  <p>Only one toplevel window appears and I cant go to the next toplevel</p>
  
  <p>My code is:</p>
  
  <pre><code>from tkinter import *
  
  root = Tk()
  def go_cmd():
      list = [1,2,3,4,5]
      for i in list:
          win = Toplevel()
  
          def next_cmd():
              win.destroy()
  
          l = Label(text = i)
          l.grid(row=0,column=0)
          b = Button(text="Next",command=next_cmd)
          b.grid(row=1,column=0)
  
          win.mainloop()
  
  
  
  b1 = Button(root,text = " Go ",command = go_cmd)
  b1.grid(row=0,column=0)
  
  
  
  
  root.mainloop()
  </code></pre>