code: def toggle_pac(self):
          if Pac is not None:
              pac_on = self.pac['pac_on'].get_value()
              self.pac['prep'].setEnabled(pac_on)
              self.pac['box_metric'].setEnabled(pac_on)
              self.pac['box_complex'].setEnabled(pac_on)
              self.pac['box_surro'].setEnabled(pac_on)
              self.pac['box_opts'].setEnabled(pac_on)
              if not pac_on:
                  self.pac['prep'].set_value(False)
          if Pac is not None and pac_on:
              pac = self.pac
              hilb_on = pac['hilbert_on'].isChecked()
              wav_on = pac['wavelet_on'].isChecked()
              for button in pac['hilbert'].values():
                  button[0].setEnabled(hilb_on)
                  if button[1] is not None:
                      button[1].setEnabled(hilb_on)
              pac['wav_width'][0].setEnabled(wav_on)
              pac['wav_width'][1].setEnabled(wav_on)
              if pac['metric'].get_value() in [
                      'Kullback-Leibler Distance',
                      'Heights ratio']:
                  pac['nbin'][0].setEnabled(True)
                  pac['nbin'][1].setEnabled(True)
              else:
                  pac['nbin'][0].setEnabled(False)
                  pac['nbin'][1].setEnabled(False)
              if pac['metric'] == 'ndPac':
                  for button in pac['surro'].values():
                      button[0].setEnabled(False)
                      if button[1] is not None:
                          button[1].setEnabled(False)
                  pac['surro']['pval'][0].setEnabled(True)
              ndpac_on = pac['metric'].get_value() == 'ndPac'
              surro_on = logical_and(pac['surro_method'].get_value() != ''
                                         'No surrogates', not ndpac_on)
              norm_on = pac['surro_norm'].get_value() != 'No normalization'
              blocks_on = 'across time' in pac['surro_method'].get_value()
              pac['surro_method'].setEnabled(not ndpac_on)
              for button in pac['surro'].values():
                  button[0].setEnabled(surro_on and norm_on)
                  if button[1] is not None:
                      button[1].setEnabled(surro_on and norm_on)
              pac['surro']['nblocks'][0].setEnabled(blocks_on)
              pac['surro']['nblocks'][1].setEnabled(blocks_on)
              if ndpac_on:
                  pac['surro_method'].set_value('No surrogates')
                  pac['surro']['pval'][0].setEnabled(True)