code: def paintEvent(self, event):
      if not self.pixmap:
          return super(Canvas, self).paintEvent(event)
  
      p = self._painter
      p.begin(self)
      p.setRenderHint(QPainter.Antialiasing)
      p.setRenderHint(QPainter.HighQualityAntialiasing)
      p.setRenderHint(QPainter.SmoothPixmapTransform)
  
      p.scale(self.scale, self.scale)
      p.translate(self.offsetToCenter())
  
      p.drawPixmap(0, 0, self.pixmap)
      Shape.scale = self.scale
      for shape in self.shapes:
          if (
              shape.selected or not self._hideBackround
          ) and self.isVisible(shape):
              shape.fill = shape.selected or shape == self.hShape
              shape.paint(p)
      if self.current:
          self.current.paint(p)
          self.line.paint(p)
      if self.selectedShapesCopy:
          for s in self.selectedShapesCopy:
              s.paint(p)
  
      # Paint rect
      if (
          self.current is not None
          and len(self.line) == 2
          and not self.fourpoint
      ):
          # print('Drawing rect')
          leftTop = self.line[0]
          rightBottom = self.line[1]
          rectWidth = rightBottom.x() - leftTop.x()
          rectHeight = rightBottom.y() - leftTop.y()
          p.setPen(self.drawingRectColor)
          brush = QBrush(Qt.BDiagPattern)
          p.setBrush(brush)
          p.drawRect(leftTop.x(), leftTop.y(), rectWidth, rectHeight)
  
      # ADD：
      if (
          self.fillDrawing()
          and self.fourpoint
          and self.current is not None
          and len(self.current.points) >= 2
      ):
          print("paint event")
          drawing_shape = self.current.copy()
          drawing_shape.addPoint(self.line[1])
          drawing_shape.fill = True
          drawing_shape.paint(p)
  
      if (
          self.drawing()
          and not self.prevPoint.isNull()
          and not self.outOfPixmap(self.prevPoint)
      ):
          p.setPen(QColor(0, 0, 0))
          p.drawLine(
              int(self.prevPoint.x()),
              0,
              int(self.prevPoint.x()),
              self.pixmap.height(),
          )
          p.drawLine(
              0,
              int(self.prevPoint.y()),
              self.pixmap.width(),
              int(self.prevPoint.y()),
          )
  
      self.setAutoFillBackground(True)
      if self.verified:
          pal = self.palette()
          pal.setColor(self.backgroundRole(), QColor(184, 239, 38, 128))
          self.setPalette(pal)
      else:
          pal = self.palette()
          pal.setColor(
              self.backgroundRole(), QColor(232, 232, 232, 255)
          )
          self.setPalette(pal)
  
      # adaptive BBOX label & index font size
      if self.pixmap:
          h, w = self.pixmap.size().height(), self.pixmap.size().width()
          fontszie = int(max(h, w) / 48)
          for s in self.shapes:
              s.fontsize = fontszie
  
      p.end()
  
imports: import copy
  from PyQt5.QtCore import Qt, pyqtSignal, QPointF, QPoint
  from PyQt5.QtGui import QPainter, QBrush, QColor, QPixmap
  from PyQt5.QtWidgets import QWidget, QMenu, QApplication
  from libs.shape import Shape
  from libs.utils import distance
label_desc: Use image node_id 32 for calling the Canvas obj's underlying member method code with example usage: obj.paintEvent(event) and returns: super