code: def __init__(self, *args, **kwargs):
      super(Canvas, self).__init__(*args, **kwargs)
      # Initialise local state.
      self.mode = self.EDIT
      self.shapes = []
      self.shapesBackups = []
      self.current = None
      self.selectedShapes = []
      self.selectedShape = None  # save the selected shape here
      self.selectedShapesCopy = []
      self.drawingLineColor = QColor(0, 0, 255)
      self.drawingRectColor = QColor(0, 0, 255)
      self.line = Shape(line_color=self.drawingLineColor)
      self.prevPoint = QPointF()
      self.offsets = QPointF(), QPointF()
      self.scale = 1.0
      self.pixmap = QPixmap()
      self.visible = {}
      self._hideBackround = False
      self.hideBackround = False
      self.hShape = None
      self.hVertex = None
      self._painter = QPainter()
      self._cursor = CURSOR_DEFAULT
      # Menus:
      self.menus = (QMenu(), QMenu())
      # Set widget options.
      self.setMouseTracking(True)
      self.setFocusPolicy(Qt.WheelFocus)
      self.verified = False
      self.drawSquare = False
      self.fourpoint = True  # ADD
      self.pointnum = 0
      self.movingShape = False
      self.selectCountShape = False
  
      # initialisation for panning
      self.pan_initial_pos = QPoint()
  
      # lockedshapes related
      self.lockedShapes = []
      self.isInTheSameImage = False
  
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 1 to create a new Canvas object from inherited base classes: QWidget with example: obj = Canvas()