code: def paintEvent(self, event):
          
          if not self.pixmap:
              return
          rect = event.rect()
          x1, y1, x2, y2 = rect.getCoords()
          width = x2 - x1 + 1
          height = y2 - y1 + 1
  
          # redraw the screen from backing pixmap
          painter = QPainter(self)
          rect = QtCore.QRect(x1, y1, width, height)
          painter.drawPixmap(rect, self.pixmap, rect)
docs: When an area of the window is exposed, we just copy out of the
          server-side, off-screen pixmap to that area.