title: How to add a scrollbar to pyqt 5 gui?
body: <p>I have created a gui with controller file to switch between windows. The files includes several parameters which will be set by previous windows, hence, the size can be quite big. Therefore, I need to create a scrollbar to be able to reach the last elements, but wonder how I can implement this in my code. </p>
  
  <p>from controller.py</p>
  
  <pre class="lang-py prettyprint-override"><code>import sys
  from PyQt5 import QtCore, QtWidgets
  
  from firstwindow import Login
  class Controller:
  
      def __init__(self):
          pass
  
      def show_login(self):
          self.login = Login()
          self.login.switch_window.connect(self.show_main)
          self.login.show()
  
      def show_main(self):
          self.MAP                   = self.login.MAP
          #Parameters from file
          self.NUM                    = self.login.spinBoxNUM.value()
          self.login.close()
  
  
  def main():
      app = QtWidgets.QApplication(sys.argv)
      controller = Controller()
      controller.show_login()
      sys.exit(app.exec_())
  
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>and from the Login class file:
  firstwindow.py</p>
  
  <pre class="lang-py prettyprint-override"><code>import sys
  from PyQt5 import QtCore, QtWidgets, QtGui
  
  class Login(QtWidgets.QWidget):
  
      switch_window = QtCore.pyqtSignal()
  
      def __init__(self):
          QtWidgets.QWidget.__init__(self)
          self.setupUi(self)
          self.setWindowTitle('First')
  
      def setupUi(self, FirstWindow):
          FirstWindow.setObjectName("First")
          FirstWindow.setEnabled(True)
          FirstWindow.resize(675,776)
  
          FirstWindow.setFocusPolicy(QtCore.Qt.TabFocus)
  
          layout = QtWidgets.QGridLayout()
          #Lots of elements + buttons: example:
          self.spinBoxNUM = QtWidgets.QSpinBox()
          layout.addWidget(self.spinBoxNUM,1,2)
          self.spinBoxLEVELS  = QtWidgets.QSpinBox()
          self.spinBoxLEVELS.setValue(2)
          self.spinBoxLEVELS.setMaximum(156)
          layout.addWidget(self.spinBoxLEVELS,11,2)
  
          #CONTINUE AND QUIT BUTTON
          self.QuitButton      = QtWidgets.QPushButton("Quit")
          self.QContinueButton = QtWidgets.QPushButton("Continue")
          #actions
          self.QuitButton.clicked.connect(FirstWindow.close)
          self.QContinueButton.clicked.connect(self.login)
          layout.addWidget(self.QuitButton,15,1)
          layout.addWidget(self.QContinueButton,15,2)
  
          self.setLayout(layout)
       def login(self):
          self.MAP    = [[1 for x in range(4)]for y in range(self.LEVELS)]
          self.switch_window.emit()
  </code></pre>