title: python GUI closing one frame and opening another
body: <p>I'm writing a program that uses two classes (team class and league class) for a hockey team.  The GUI is simulating a single round elimination "playoffs" with 8 teams.  I want the GUI to allow the user to enter the scores for the first round of 4 games and then click the submit button.  When this button is pressed, I want a messagebox to pop up that lists the winners, and then when that box is closed, the original frame to close, and have the round 2 entry fields pop up.  I'm really unsure how to do this. 
  I have a lot of code, so I haven't included the code for the team and league classes because I don't think it is necessary for this question, but I can post it if anyone wants.  </p>
  
  <p>So basically, is there a way to close on frame/ change the look of a frame to a new frame with the click of a button? </p>
  
  <pre><code>#methods to set the scores for round 1
  def round1game1team1Score(self):
      """set the score for team 1"""
      team1= self.l.getTeambyPosition(0)
      teamScore= self.round1game1team1Var.get()
      team1.setScore(teamScore)
  
  def round1game1team8Score(self):
      """sets the score for team 8"""
      team8= self.l.getTeambyPosition(7)
      teamScore= self.round1game1team8Var.get()
      team8.setScore(teamScore)
  
  def round1game2team2Score(self):
      """sets the score for team 2"""
      team2= self.l.getTeambyPosition(1)
      teamScore= self.round1game2team2Var.get()
      team2.setScore(teamScore)
  
  def round1game2team7Score(self):
      """sets the score for team 7"""
      team7= self.l.getTeambyPosition(6)
      teamScore= self.round1game2team7Var.get()
      team7.setScore(teamScore)
  
  def round1game3team3Score(self):
      """sets the score for team 3"""
      team3= self.l.getTeambyPosition(2)
      teamScore= self.round1game3team3Var.get()
      team3.setScore(teamScore)
  
  def round1game3team6Score(self):
      team6= self.l.getTeambyPosition(5)
      teamScore= self.round1game3team6Var.get()
      team6.setScore(teamScore)
  
  def round1game4team4Score(self):
      """sets the score for team 4"""
      team4= self.l.getTeambyPosition(3)
      teamScore= self.round1game4team4Var.get()
      team4.setScore(teamScore)
  
  def round1game4team5Score(self):
      """sets the score for team 5"""
      team5= self.l.getTeambyPosition(4)
      teamScore= self.round1game4team5Var.get()
      team5.setScore(teamScore)
  
  
  #methods that determine the winners in round 1
  def round1game1Winner(self):
      """determines the winner of round 1 game 1"""
      team1= self.l.getTeambyPosition(0)
      team8= self.l.getTeambyPosition(7)
      if team1.getScore() &gt; team8.getScore():
          return team1.getTeam()
      else:
          return team8.getTeam()
  
  def round1game2Winner(self):
      """determines the winner of round 1 game 2"""
      team2= self.l.getTeambyPosition(1)
      team7= self.l.getTeambyPosition(6)
      if team2.getScore() &gt; team7.getScore():
          return team2.getTeam()
      else:
          return team7.getTeam()
  
  def round1game3Winner(self):
      """determines the winner of round 1 game 3"""
      team3= self.l.getTeambyPosition(2)
      team6= self.l.getTeambyPosition(5)
      if team3.getScore() &gt; team6.getScore():
          return team3.getTeam()
      else:
          return team6.getTeam()
  
  def round1game4Winner(self):
      """determines the winner of round 1 game 4"""
      team4= self.l.getTeambyPosition(3)
      team5= self.l.getTeambyPosition(4)
      if team4.getScore() &gt; team5.getScore():
          return team4.getTeam()
      else:
          return team5.getTeam()
  
  def closeRound1Frame(self):
      """closes round1 frame"""
      self.Destroy()
  
  
  
  class Round1Frame(Frame):
      """GUI for round1 of the playoffs"""
      def __init__(self):
          """sets up the window and widgets"""
          Frame.__init__(self)
          self.master.title("2013 Stanley Cup Playoffs Round 1")
          self.grid()
          self.l= League()
  
          #round 1 game 1
          #team 1 label and entry field
          team1= self.l.getTeambyPosition(0).getTeam()
          round1game1team1Label= Label(self, text= str(team1) + '   ' + 'vs.' )
          round1game1team1Label.grid(row = 0, column = 0)
          self.round1game1team1Var = IntVar()
          round1game1team1Entry= Entry(self,
                                       textvariable= self.round1game1team1Var)
          round1game1team1Entry.grid(row = 1, column = 0)
  
          #team 8 label and entry field
          team8= self.l.getTeambyPosition(7).getTeam()
          round1game1team8Label= Label(self, text= str(team8))
          round1game1team8Label.grid(row = 0, column = 1)
          self.round1game1team8Var= IntVar()
          round1game1team8Entry= Entry(self,
                                       textvariable= self.round1game1team8Var)
          round1game1team8Entry.grid(row = 1, column = 1)
  
  
          #round 1 game 2
          #team 2 label and entry field
          team2= self.l.getTeambyPosition(1).getTeam()
          round1game2team2Label= Label(self, text= str(team2) + '   ' + 'vs.')
          round1game2team2Label.grid(row = 0, column = 2)
          self.round1game2team2Var= IntVar()
          round1game2team2Entry= Entry(self,
                                       textvariable= self.round1game2team2Var)
          round1game2team2Entry.grid(row = 1, column = 2)
  
          #team 7 label and entry field
          team7= self.l.getTeambyPosition(6).getTeam()
          round1game2team7Label= Label(self, text= str(team7))
          round1game2team7Label.grid(row = 0, column = 3)
          self.round1game2team7Var= IntVar()
          round1game2team7Entry= Entry(self,
                                       textvariable= self.round1game2team7Var)
          round1game2team7Entry.grid(row = 1, column = 3)
  
  
          #round 1 game 3
          #team 3 label and entry field
          team3= self.l.getTeambyPosition(2).getTeam()
          round1game3team3Label= Label(self, text= str(team3) + '   ' + 'vs.')
          round1game3team3Label.grid(row = 2, column = 0)
          self.round1game3team3Var= IntVar()
          round1game3team3Entry= Entry(self,
                                       textvariable= self.round1game3team3Var)
          round1game3team3Entry.grid(row = 3, column = 0)
  
          #team 6 label and entry field
          team6= self.l.getTeambyPosition(5).getTeam()
          round1game3team6Label= Label(self, text= str(team6))
          round1game3team6Label.grid(row = 2, column = 1)
          self.round1game3team6Var= IntVar()
          round1game3team6Entry= Entry(self,
                                       textvariable= self.round1game3team6Var)
          round1game3team6Entry.grid(row = 3, column = 1)
  
  
          #round 1 game 4
          #team 4 label and entry field
          team4= self.l.getTeambyPosition(3).getTeam()
          round1game4team4Label= Label(self, text= str(team4) + '   ' + 'vs.')
          round1game4team4Label.grid(row = 2, column = 2)
          self.round1game4team4Var= IntVar()
          round1game4team4Entry= Entry(self,
                                       textvariable= self.round1game4team4Var)
          round1game4team4Entry.grid(row = 3, column = 2)
  
          #team 5 label and field entry
          team5= self.l.getTeambyPosition(4).getTeam()
          round1game4team5Label= Label(self, text= str(team5))
          round1game4team5Label.grid(row = 2, column = 3)
          self.round1game4team5Var= IntVar()
          round1game4team5Entry= Entry(self,
                                       textvariable= self.round1game4team5Var)
          round1game4team5Entry.grid(row = 3, column =3)
  
          #button to submit round 1 scores
          round1Button= Button(self, text= 'Submit Scores', command= self.round1)
          round1Button.grid(row = 4, column = 1, columnspan = 2)
  
  
  
      def round1(self):
          """event handler for the round1Button"""
          round1game1team1Score(self)
          round1game1team8Score(self)
          round1game2team2Score(self)
          round1game2team7Score(self)
          round1game3team3Score(self)
          round1game3team6Score(self)
          round1game4team4Score(self)
          round1game4team5Score(self)
          round1game1Winner(self)
          round1game2Winner(self)
          round1game3Winner(self)
          round1game4Winner(self)
          messagebox.showinfo(title= 'Round 1 Results',
                              message= 'Winners advancing to next round: ' + '\n' + str(round1game1Winner(self))
                              + '\n' + str(round1game2Winner(self)) + '\n' +
                              str(round1game3Winner(self)) + '\n' +
                              str(round1game4Winner(self)))
          closeRound1Frame(self)
          Round2Frame().mainloop()
  
  class Round2Frame(Frame):
      """GUI for round 2 of the playoffs"""
      def __int__(self):
          """sets up the window and widgets"""
          Frame.__init__(self)
          self.master.title('2013 Stanley Cup Playoffs Round 2')
          self.grid()
  
          #round 2 game 1
          #first team label and entry field
          team1= round1game1Winner(self)
          round2game1team1Label= Label(self, text= str(team1) + 'vs.   ')
          round2game1team1Label.grid(row = 0, column = 0)
          self.round2game1team1Var= IntVar()
          round2game1team1Entry= Entry(self,
                                       textvariable= self.round2game1team1Var)
          round2game1team1Entry.grid(row = 1, column = 0)
  
          #second team label and entry field
          team2= round1game2Winner(self)
          round2game1team2Label= Label(self, text= str(team2))
          round2game1team2Label.grid(row = 0, column = 1)
          self.round2game1team2Var= IntVar()
          round2game1team2Entry= Entry(self,
                                       textvariable= self.round2game1team2Var)
          round2game1team2Entry.grid(row = 1, column = 1)
  
  
          #round 2 game 2
          #third team label and entry field
          team3= round1game3Winner(self)
          round2game2team3Label= Label(self, text= str(team3) + 'vs.   ')
          round2game2team3Label.grid(row = 0, column = 2)
          self.round2game2team3Var= IntVar()
          round2game2team3Entry= Entry(self,
                                       textvariable= self.round2game2team3Var)
          round2game2team3Entry.grid(row = 1, column = 2)
  
          #fourth team label and entry field
          team4= round1game4Winner(self)
          round2game2team4Label= Label(self, text= str(team4))
          round2game2team4Label.grid(row = 0, column = 3)
          self.round2game2team4Var= IntVar()
          round2game2team4Entry= Entry(self,
                                       textvariable= self.round2game2team4Var)
          round2game2team4Entry.grif(row = 1, column = 3)
  
  
  
  
  def main():
      """instantiate and pop up the window"""
      Round1Frame().mainloop()
  
  main()
  </code></pre>