code: def paint(self, painter):
      if self.points:
          color = (
              self.select_line_color
              if self.selected
              else self.line_color
          )
          pen = QPen(color)
          # Try using integer sizes for smoother drawing(?)
          # pen.setWidth(max(1, int(round(2.0 / self.scale))))
          painter.setPen(pen)
  
          line_path = QPainterPath()
          vrtx_path = QPainterPath()
  
          line_path.moveTo(self.points[0])
          # Uncommenting the following line will draw 2 paths
          # for the 1st vertex, and make it non-filled, which
          # may be desirable.
          # self.drawVertex(vrtx_path, 0)
  
          for i, p in enumerate(self.points):
              line_path.lineTo(p)
              self.drawVertex(vrtx_path, i)
          if self.isClosed():
              line_path.lineTo(self.points[0])
  
          painter.drawPath(line_path)
          painter.drawPath(vrtx_path)
          painter.fillPath(vrtx_path, self.vertex_fill_color)
  
          # Draw text at the top-left
          if self.paintLabel:
              min_x = sys.maxsize
              min_y = sys.maxsize
              for point in self.points:
                  min_x = min(min_x, point.x())
                  min_y = min(min_y, point.y())
              if min_x != sys.maxsize and min_y != sys.maxsize:
                  font = QFont()
                  font.setPointSize(self.fontsize)
                  font.setBold(True)
                  painter.setFont(font)
                  if self.label is None:
                      self.label = ""
                  if min_y < MIN_Y_LABEL:
                      min_y += MIN_Y_LABEL
                  painter.drawText(min_x, min_y, self.label)
  
          # Draw number at the top-right
          if self.paintIdx:
              min_x = sys.maxsize
              min_y = sys.maxsize
              for point in self.points:
                  min_x = min(min_x, point.x())
                  min_y = min(min_y, point.y())
              if min_x != sys.maxsize and min_y != sys.maxsize:
                  font = QFont()
                  font.setPointSize(self.fontsize)
                  font.setBold(True)
                  painter.setFont(font)
                  text = ""
                  if self.idx != None:
                      text = str(self.idx)
                  if min_y < MIN_Y_LABEL:
                      min_y += MIN_Y_LABEL
                  painter.drawText(min_x, min_y, text)
  
          if self.fill:
              color = (
                  self.select_fill_color
                  if self.selected
                  else self.fill_color
              )
              painter.fillPath(line_path, color)
  
imports: import math
  import sys
  from PyQt5.QtCore import QPointF
  from PyQt5.QtGui import QColor, QPen, QPainterPath, QFont
  from libs.utils import distance
label_desc: Use image node_id 11 for calling the Shape obj's underlying member method code with example usage: obj.paint(painter) without return types