title: How do you switch between two windows in PyQt?
body: <p>I want to make a new PyQt window show up and hide the current window when I click a button. After playing around for hours, I haven't found a good way to do this.</p>
  
  <p>When I try to show a new QDialog and hide the current one, the program closes. It works if another window is open. I believe this is because it is viewing the last window as closing and terminates, or maybe the new QDialog is falling off the stack.</p>
  
  <p>My current method involves storing the QDialog as a variable in the current dialog, then showing it and hiding current dialog. This seems like a total hack, though.</p>
  
  <p>Example below:</p>
  
  <pre><code>def _createQuestion(self):
      # initialization of the UI and everything goes on in the constructor
      self.dialog = QuestionBanks()
      self.dialog.show()
      self.hide()
  </code></pre>
  
  <p>Is there a better way of switching a single window to a distinct different single window in PyQt4?</p>