code: def start_capture(self):
          
          previous_map_tool = self.canvas.mapTool()
          if previous_map_tool != self.tool:
              self.previous_map_tool = previous_map_tool
          self.canvas.setMapTool(self.tool)
          self.hide()
docs: Start capturing the rectangle.