title: How to control display of tkinter Toplevel windows?
body: <p>This is the short form of my code.
  In [<code>input</code>] window, I want it to pop up the [<code>input2</code>] window only and the [<code>solve</code>] window will pop up after I hit the button <kbd>Solve!</kbd>. </p>
  
  <p>Currently, however, the [<code>input2</code>] and [<code>solve</code>] windows pop-up at the same time and the <kbd>Solve!</kbd> button doesn't do anything when it's clicked.</p>
  
  <p>This is my code:</p>
  
  <pre><code>from tkinter import *
  
  class welcome():
      def __init__(self, master): #master: root - the main window
          # welcome and introduction
          self.master=master
          self.master.geometry("500x200")
  
          self.welcome = Label(self.master, text="Welcome to The Bees's")
          self.welcome.pack()
          self.intro = Label(self.master, text="This is our project for Python course")
          self.intro.pack()
          self.intro2 = Label(self.master, text="This program is use for solving Linear Programming, IP, BIP, mixed... problem")
          self.intro2.pack()
  
          self.startbutton = Button(self.master, text="Start", bg="yellow")
          self.startbutton.pack()
          self.startbutton.config(command=self.gotoinput)
  
      def gotoinput(self):
          root2 = Toplevel(self.master)
          self.input1=input(root2)
  </code></pre>
  
  <p>Class for input window:</p>
  
  <pre><code>class input():
      def __init__(self,master):
          self.master=master
          self.master.title("Input")
          self.master.geometry("700x500")
          #cancle
          self.Canclebutton=Button(self.master,text="Cancle",command=self.master.destroy).grid(row=3,column=1)
          #OK
          self.Enterbutton=Button(self.master,text="ENTER",command=self.gotoinput2).grid(row=3,column=2)
  
      def gotoinput2(self):
          root3=Toplevel(self.master)
          self.input22=input2(root3)
  </code></pre>
  
  <p>Class for input2 window:</p>
  
  <pre><code>class input2():
      def __init__(self,master):
          self.master=master
          self.master.title("Input2")
          self.master.geometry("700x500")
          # cancle
          self.Canclebutton = Button(self.master, text="Cancle", command=self.master.destroy).grid(row=0, column=0)
          # OK
          self.Solvebutton = Button(self.master, text="Solve!", command=self.gotosolve()).grid(row=0, column=1)
          print("Through")
  
      def gotosolve(self):
          print("gotosolve")
          root4=Toplevel(self.master)
          self.solve11=solve(root4)
  </code></pre>
  
  <p>Class for Solve window:</p>
  
  <pre><code>class solve():
      def __init__(self,master):
          self.master = master
          self.master.title("Solution")
          self.master.geometry("700x500")
          # cancle
          self.Canclebutton = Button(self.master, text="Cancle", command=self.master.destroy).grid(row=0,column=0)
  </code></pre>
  
  <p>Main function:</p>
  
  <pre><code>def main():
      # create a main window
      root = Tk()
      root.title("The Bees's")
  
      b = welcome(root)
      # end line
      root.mainloop()
  
  main()
  </code></pre>