

def _format_layoutlist(layout, indent=0, indent_size=2):
    'Formats a layout list so we can pass the result to ttk::style\n    layout and ttk::style settings. Note that the layout doesn\'t has to\n    be a list necessarily.\n\n    E.g.:\n      [("Menubutton.background", None),\n       ("Menubutton.button", {"children":\n           [("Menubutton.focus", {"children":\n               [("Menubutton.padding", {"children":\n                [("Menubutton.label", {"side": "left", "expand": 1})]\n               })]\n           })]\n       }),\n       ("Menubutton.indicator", {"side": "right"})\n      ]\n\n      returns:\n\n      Menubutton.background\n      Menubutton.button -children {\n        Menubutton.focus -children {\n          Menubutton.padding -children {\n            Menubutton.label -side left -expand 1\n          }\n        }\n      }\n      Menubutton.indicator -side right'
    script = []
    for layout_elem in layout:
        (elem, opts) = layout_elem
        opts = (opts or {
            
        })
        fopts = ' '.join(_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, layout_elem)
            script.append(newscript)
            indent -= indent_size
            script.append(('%s}' % (' ' * indent)))
        else:
            script.append(head)
    return ('\n'.join(script), indent)

dataset/ETHPy150Open francelabs/datafari/windows/python/Lib/lib-tk/ttk.py _format_layoutlist/VarMisuse@137/487 `indent_size`->`layout_elem`