original_docstring: Find a child that has mouse over itself
docstring: Find a child that has mouse over itself
docstring_tokens: Find a child that has mouse over itself
code: def check_hover(self):
          """Find a child that has mouse over itself"""
  
          # When mouse is outside window, reset hover child
          if not pygame.mouse.get_focused():
              if self.hover_child:
                  self.hover_child.hover = False
                  self.hover_child = None
              return
  
          mouse_pos = pygame.mouse.get_pos()
  
          # Find child under cursor
          for child in self.children:
              if mouse_pos[0] > child.pos[0] and mouse_pos[0] < child.pos[0] + child.size[0]:
                  if mouse_pos[1] > child.pos[1] and mouse_pos[1] < child.pos[1] + child.size[1]:
                      if child.is_active:
                          self.hover_child = child
                          child.hover = True
                      # If a menu has been clicked open but cursor is over another menu, open that one with a click
                      if self.open_menu and self.open_menu != child and type(child) is Menu:
                          child.get_clicked()
                      continue
              child.hover = False
code_tokens: def check_hover ( self ) : if not pygame . mouse . get_focused ( ) : if self . hover_child : self . hover_child . hover = False self . hover_child = None return mouse_pos = pygame . mouse . get_pos ( ) for child in self . children : if mouse_pos [ 0 ] > child . pos [ 0 ] and mouse_pos [ 0 ] < child . pos [ 0 ] + child . size [ 0 ] : if mouse_pos [ 1 ] > child . pos [ 1 ] and mouse_pos [ 1 ] < child . pos [ 1 ] + child . size [ 1 ] : if child . is_active : self . hover_child = child child . hover = True if self . open_menu and self . open_menu != child and type ( child ) is Menu : child . get_clicked ( ) continue child . hover = False
short_docstring: Find a child that has mouse over itself
short_docstring_tokens: Find a child that has mouse over itself
comment: """Find a child that has mouse over itself"""$SEP$# When mouse is outside window, reset hover child$SEP$# Find child under cursor$SEP$# If a menu has been clicked open but cursor is over another menu, open that one with a click