def _format_layoutlist(layout, indent=0, indent_size=2):
 script = []
 for layout_elem in layout:
  (elem, opts) = layout_elem
  opts = (opts or {})
  fopts = ' '.join(map(str, _format_optdict(opts, True, 'children')))
  head = ('%s%s%s' % ((' ' * indent), elem, ((' %s' % fopts) if fopts else '')))
  if ('children' in opts):
   script.append((head + ' -children {'))
   indent += indent_size
   (newscript, indent) = _format_layoutlist(opts['children'], indent, indent_size)
   script.append(newscript)
   indent -= indent_size
   script.append(('%s}' % (' ' * indent)))
  else:
   script.append(head)
 return ('\n'.join(script), indent)

def _format_layoutlist ( layout , indent = 0 , indent_size = 2 ) : script = [ ] for layout_elem in layout : ( elem , opts ) = layout_elem opts = ( opts or { } ) fopts = ' ' . join ( map ( str , _format_optdict ( opts , True , 'children' ) ) ) head = ( '%s%s%s' % ( ( ' ' * indent ) , elem , ( ( ' %s' % fopts ) if fopts else '' ) ) ) if ( 'children' in opts ) : script . append ( ( head + ' -children {' ) ) indent += indent_size ( newscript , indent ) = _format_layoutlist ( opts [ 'children' ] , indent , indent_size ) script . append ( newscript ) indent -= indent_size script . append ( ( '%s}' % ( ' ' * indent ) ) ) else : script . append ( head ) return ( '\n' . join ( script ) , indent )
formats a layout list so we can pass the result to ttk::style layout and ttk::style settings .