code: def resize(self, width: int,  height: int):
          
          self.width = width // self.widget.devicePixelRatio()
          self.height = height // self.widget.devicePixelRatio()
          self.buffer_width = width
          self.buffer_height = height
  
          if self.ctx:
              self.set_default_viewport()
  
          # Make sure we notify the example about the resize
          super().resize(self.buffer_width, self.buffer_height)
docs: Replacement for Qt's resizeGL method.