original_docstring: Scale self and all children menu objects to a new width
docstring: Scale self and all children menu objects to a new width
docstring_tokens: Scale self and all children menu objects to a new width
code: def resize_width(self, new_width=512):
          """Scale self and all children menu objects to a new width"""
          self.size = [new_width, self.size[1]]
          child_size = self.get_child_size()
  
          # Find child with longest text
          longest_child = None
  
          for child in self.children:
              child.size = child_size
              if not longest_child or len(child.text) > len(longest_child.text):
                  longest_child = child
          # Find biggest possible font
          font = longest_child.get_font()
  
          # Reposition children and apply new font
          for index, child in enumerate(self.children):
  
              if type(child) is Menu:
                  child.pos[0] = self.pos[0] + (child.size[0] * index)
                  child.set_menu_text(font)
                  for grand_child in child.children:
                      grand_child.pos[0] = self.pos[0] + \
                          (grand_child.size[0] * index)
                      grand_child.set_menu_text(font)
code_tokens: def resize_width ( self , new_width = 512 ) : self . size = [ new_width , self . size [ 1 ] ] child_size = self . get_child_size ( ) longest_child = None for child in self . children : child . size = child_size if not longest_child or len ( child . text ) > len ( longest_child . text ) : longest_child = child font = longest_child . get_font ( ) for index , child in enumerate ( self . children ) : if type ( child ) is Menu : child . pos [ 0 ] = self . pos [ 0 ] + ( child . size [ 0 ] * index ) child . set_menu_text ( font ) for grand_child in child . children : grand_child . pos [ 0 ] = self . pos [ 0 ] + ( grand_child . size [ 0 ] * index ) grand_child . set_menu_text ( font )
short_docstring: Scale self and all children menu objects to a new width
short_docstring_tokens: Scale self and all children menu objects to a new width
comment: """Scale self and all children menu objects to a new width"""$SEP$# Find child with longest text$SEP$# Find biggest possible font$SEP$# Reposition children and apply new font