title: How to keep a widget in PyQt5 cramming the screen?
body: <p>When I learned the <code>QHBoxLayout</code> and <code>QVBoxLayout</code> in <code>PyQt5</code>, I found it unable to use them with <code>QMainWindow</code>.They must lean on <code>QWidget</code>.Here is my code:</p>
  
  <pre><code>import sys
  from PyQt5.QtWidgets import QApplication,QMainWindow,QWidget,QLabel,QHBoxLayout,QVBoxLayout
  
  class Example(QMainWindow) :
      def __init__(self) :
          super().__init__()
          self.build_inter()
  
      def build_inter(self) :
          self.setGeometry(300,300,300,220)
  
          self.root_widget=QWidget(self)
          self.root_widget.resize(self.size())
  
          self.name_label=QLabel("Wang Suyu",self.root_widget)
          self.age_label=QLabel("14",self.root_widget)
  
          hbox=QHBoxLayout()
          hbox.addStretch(1)
          hbox.addWidget(self.name_label)
          hbox.addWidget(self.age_label)
          vbox=QVBoxLayout()
          vbox.addStretch(1)
          vbox.addLayout(hbox)
  
          self.root_widget.setLayout(vbox)
  
          self.show()
  
  if __name__ == '__main__':
      app=QApplication(sys.argv)
      example=Example()
      sys.exit(app.exec_())
  </code></pre>
  
  <p>However, as a widget, I have no way to let <code>QWidget</code> automatically cram the screen as I change the size of screen with my mouse.The <code>root_widget</code> and two labels will just keep original.</p>
  
  <p>How should I do? I really do NOT wanna change the super class of <code>Example</code></p>