title: Why Does "mainloop()" For One Window Open Multiple Windows?
body: <p>I'm using Tkinter. For whatever reason, &quot;Window1.mainloop()&quot; in this script opens both Window1 and Window2. Also, pressing the button on Window1 doesn't open Window2, but I think that's unrelated.</p>
  <pre><code>import tkinter as tk
  
  Window1 = tk.Tk()
  Window1.title(&quot;Window 1&quot;)
  Window1.geometry(&quot;300x200&quot;)
  
  Window2 = tk.Tk()
  Window2.title(&quot;Window 2&quot;)
  Window2.geometry(&quot;150x100&quot;)
  
  def RunWindow2():
      Window2.mainloop()
  
  Button1 = tk.Button(Window1, text = &quot;Open Window 2.&quot;, command = RunWindow2)
  Button1.pack()
  
  Label1 = tk.Label(Window2, text = &quot;This is Window 2.&quot;)
  Label1.pack()
  
  Window1.mainloop()
  </code></pre>