code: def set_rectangle(self, rectangle):
          
          if rectangle == self.rectangle():
              return False
  
          if rectangle is None:
              self.reset()
          else:
              self.start_point = QgsPointXY(
                  rectangle.xMinimum(), rectangle.yMinimum())
              self.end_point = QgsPointXY(
                  rectangle.xMaximum(), rectangle.yMaximum())
              self.show_rectangle(self.start_point, self.end_point)
          return True
docs: Set the rectangle for the selection.
          :param rectangle:
          :return: