title: Creating a multi-window application in PySide
body: <p>I am new to PySide, I want to create a multi-window application.  For example, the first window will be login window, and if the login is correct then the login window should hide and the next window should appear.</p>
  
  <p>How can I achieve this?</p>
  
  <pre><code>import sys
  from PySide.QtGui import *
  from PySide.QtCore import *
  import chooseoption
  
  class Form(QDialog):
  def __init__(self, parent = None):
      super(Form,self).__init__(parent)
  
      self.usernamelabel = QLabel("Username : ")
      self.passwordlabel = QLabel("Password : ")
      self.username = QLineEdit()
      self.password = QLineEdit()
      self.okbutton = QPushButton("Login")
      self.username.setPlaceholderText("Enter Username Here")
      self.password.setPlaceholderText("Enter Password Here")
  
      layout = QGridLayout()
      layout.addWidget(self.usernamelabel,0,0)
      layout.addWidget(self.passwordlabel,1,0)
      layout.addWidget(self.username,0,1)
      layout.addWidget(self.password,1,1)
      layout.addWidget(self.okbutton)
      self.setLayout(layout)
  
      self.usernamelist = ['priyank','stupendo','ayaan']
      self.passwordlist = ['priyank','stupendo','ayaan']
  
      self.connect(self.okbutton, SIGNAL("clicked()"),self.loginfunction)
  
  def loginfunction(self):
      usernamestatus = False
      usernameindex = -1
      passwordstatus = False
      passwordindex = -1
      for currentusername in range(len(self.usernamelist)):
          if self.passwordlist[currentusername] == self.username.text():
              usernamestatus = True
              usernameindex = self.usernamelist.index(self.passwordlist[currentusername])
  
      for currentpassword in range(len(self.passwordlist)):
          if self.usernamelist[currentpassword] ==self.password.text():
              passwordstatus = True
              passwordindex = self.passwordlist.index(self.usernamelist[currentpassword])
  
      if usernamestatus == True and passwordstatus ==True and usernameindex == passwordindex:
  
          w2 = chooseoption.Form1()
          w2.show()
  
      else:
          self.msgBox = QMessageBox()
          self.msgBox.setText("invalid!!!")
          self.msgBox.exec_()
  
  
  
  app = QApplication(sys.argv)
  form = Form()
  form.show()
  sys.exit(app.exec_())
  </code></pre>
  
  <p>This is my chooseoption.py file:</p>
  
  <pre><code>import sys
  from PySide.QtGui import *
  from PySide.QtCore import *
  
  class Form1(QDialog):
  
  def __init__(self, parent = None):
      super(Form1,self).__init__(parent)
  
      self.addbutton = QPushButton("Add file in Important list")
      self.removebutton = QPushButton("Remove file from Important list")
      self.changeaddressbutton = QPushButton("Change Location of Important File")
  
      layout = QHBoxLayout()
      layout.addWidget(self.addbutton)
      layout.addWidget(self.removebutton)
      layout.addWidget(self.changeaddressbutton)
      self.setLayout(layout)
  </code></pre>
  
  <p>The problem with this is that my second window just appears on the screen for a few milliseconds, and then disappears.  How can I fix that?</p>