code: def resizeEvent(self, event):
          
          if not self.isMaximized() and not self.isFullScreen():
              self.window_size = self.size()
          QMainWindow.resizeEvent(self, event)
docs: Reimplement Qt method