def handle_events(self):
     
     if pygame.MOUSEBUTTONDOWN in wotsuievents.event_types:
         for button in self.key_buttons.buttons:
             if button.active and button.contains(wotsuievents.mouse_pos):
                 button.handle_selected()
                 
                 if self.key_buttons.selected_button != None:
                     self.key_buttons.selected_button.handle_deselected()
                 
                 self.key_buttons.selected_button = button
                 break
         
         if self.clear_button.contains(wotsuievents.mouse_pos):
             self.clear_button.handle_selected()
         
     elif pygame.MOUSEBUTTONUP in wotsuievents.event_types:
         if (self.key_buttons.selected_button != None and
         self.key_buttons.selected_button.contains(wotsuievents.mouse_pos)):
             button = self.key_buttons.selected_button
             
             if not button.action_type in self.key_combination:
                 self.key_combination.append(button.action_type)
                 self.set_key_combination_text()
             
             button.handle_deselected()
             self.key_buttons.selected_button = None
         
         if (self.clear_button.selected and
         self.clear_button.contains(wotsuievents.mouse_pos)):
             self.set_key_combination([])
             self.clear_button.handle_deselected()
 def handle_events(self):
     wotsuicontainers.ScrollableContainer.handle_events(self)
     
     if self.viewable_area.contains(wotsuievents.mouse_pos):
         if pygame.MOUSEBUTTONDOWN in wotsuievents.event_types:
             for button in self.buttons:
                 if button.contains(wotsuievents.mouse_pos):
                     if button.selected:
                         button.handle_deselected()
                     else:
                         button.handle_selected()
                 else:
                     if button.selected:
                         button.handle_deselected()
         elif pygame.KEYDOWN in wotsuievents.event_types:
             for button in self.buttons:
                 if button.selected:
                     button.key = wotsuievents.keys_pressed[0]
                     button.handle_deselected()