title: How to set the central widget of existing MainWidnow in Python PyQt4?
body: <p>I have a code which consists of <code>3 classes</code>. The classes <code>widget1</code> and <code>widget2</code> inherit from <code>QFrame</code> class and consists of several <code>lineedit</code> and <code>combobox</code> for the user to enter information. </p>
  
  <p>So, what I want is: when the program is launched, it will firstly bring up the <code>QMainWindow</code> class with <code>widget1</code> set as the <code>central widget</code>. </p>
  
  <p>The <code>widget1</code> has a <code>Check function</code> which is connected to a button on it. The check button will check whether a condition is true based on the data entered by the user on the page. </p>
  
  <p>If the condition is true. I want the <code>widget2</code> to set it as <code>central wiget</code> of <code>MainWindow</code> to replace existing <code>central widget</code>, the <code>widget1</code>.</p>
  
  <p>My question is, how do I set the <code>widget2</code> as the central widget of existing <code>MainWidnow</code> class instance?</p>
  
  <p>This is the format of my code:</p>
  
  <pre><code>class widget1(QtGui.QFrame):
      def __init__(self,parent = None):
          ......
          ......
  
      def Check(self):
         if (condition):
             #set widget2 as central widget on MainWindow
  
  class widget2(QtGui.QFrame):
      def __int__(self,parent = None):
          .....
          .....
  
  class MainWindow(QtGui.QMainWindow):
      def __init__(self,parent = None):
          QtGui.QMainWindow.__init__(self,parent)
          ....
          mywidgetone = widget1()
          self.setCentralWidget(mywidgetone)
  
  if __name__ == '__main__':
      app = QtGui.QApplicaiton(sys.argv)
      main = MainWindow()
      main.show()
      app.exec_()
  </code></pre>