def onpress(self, event):
        """
        Reacts to key commands
        :param event: a keyboard event
        :return: if 'c' is pressed, clear all region patches
        """
        if event.key == 'c':  # clears all the contours
            for patch in self.region_patches:
                patch.remove()
            self.region_patches = []
            self.fig.canvas.draw_idle()
        elif event.key == "u":  # undo a label
            self.undobutton_action()
Reacts to key commands
        :param event: a keyboard event
        :return: if 'c' is pressed, clear all region patches