<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def on_next_button(self, event):
 """ update figures and text when a next button is selected """

        self.do_auto_save()
        self.selected_meas = []
        index = self.specimens.index(self.s)
        try:
            fit_index = self.pmag_results_data['specimens'][self.s].index(
                self.current_fit)
        except KeyError:
            fit_index = None
        except ValueError:
            fit_index = None
        if index == len(self.specimens)-1:
            index = 0
        else:
            index += 1
        # sets self.s calculates params etc.
        self.initialize_CART_rot(str(self.specimens[index]))
        self.specimens_box.SetStringSelection(str(self.s))
        if fit_index != None and self.s in self.pmag_results_data['specimens']:
            try:
                self.current_fit = self.pmag_results_data['specimens'][self.s][fit_index]
            except IndexError:
                self.current_fit = None
        else:
            self.current_fit = None
        if self.ie_open:
            self.ie.change_selected(self.current_fit)
        self.update_selection()