<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def enable_events(self):
 """enable slow wave and spindle detection if both annotations and channels are active. """

        if self.annot is not None and self.parent.channels.groups:
            self.action['spindle'].setEnabled(True)
            self.action['slow_wave'].setEnabled(True)
            self.action['analyze'].setEnabled(True)
        else:
            self.action['spindle'].setEnabled(False)
            self.action['slow_wave'].setEnabled(False)
            self.action['analyze'].setEnabled(False)