code: def resizeEvent(self, event):
          
          if self.scene is not None:
              ratio = self.width() / (self.scene.width() * 1.1)
              self.resetTransform()
              self.scale(ratio, 1)
docs: Resize scene so that it fits the whole widget.
  
          Parameters
          ----------
          event : instance of QtCore.QEvent
              not important
  
          Notes
          -----
          This function overwrites Qt function, therefore the non-standard
          name. Argument also depends on Qt.
  
          The function is used to change the scale of view, so that the scene
          fits the whole scene. There are two problems that I could not fix: 1)
          how to give the width of the label in absolute width, 2) how to strech
          scene just enough that it doesn't trigger a scrollbar. However, it's
          pretty good as it is now.