code: def swap_buffers(self):
          
          self.widget.swapBuffers()
          self.set_default_viewport()
          self.app.processEvents()
          self.frames += 1
docs: Swap buffers, set viewport, trigger events and increment frame counter