code: def show_rectangle(self, start_point, end_point):
          
          self.rubber_band.reset(QgsWkbTypes.PolygonGeometry)
          if (start_point.x() == end_point.x()
                  or start_point.y() == end_point.y()):
              return
  
          point1 = start_point
          point2 = QgsPointXY(end_point.x(), start_point.y())
          point3 = end_point
          point4 = QgsPointXY(start_point.x(), end_point.y())
  
          update_canvas = False
          self.rubber_band.addPoint(point1, update_canvas)
          self.rubber_band.addPoint(point2, update_canvas)
          self.rubber_band.addPoint(point3, update_canvas)
          self.rubber_band.addPoint(point4, update_canvas)
          # noinspection PyArgumentEqualDefault
          # no False so canvas will update
          # close the polygon otherwise it shows as a filled rect
          self.rubber_band.addPoint(point1)
          self.rubber_band.show()
docs: Show the rectangle on the canvas.
  
          :param start_point: QGIS Point object representing the origin (
              top left).
          :type start_point: QgsPoint
  
          :param end_point: QGIS Point object representing the contra-origin (
              bottom right).
          :type end_point: QgsPoint
  
          :return: