

def _script_from_settings(settings):
    'Returns an appropriate script, based on settings, according to\n    theme_settings definition to be used by theme_settings and\n    theme_create.'
    script = []
    for (name, opts) in settings.iteritems():
        if opts.get('configure'):
            s = ' '.join(_format_optdict(opts['configure'], True))
            script.append(('ttk::style configure %s %s;' % (name, s)))
        if opts.get('map'):
            s = ' '.join(_format_mapdict(opts['map'], True))
            script.append(('ttk::style map %s %s;' % (name, s)))
        if ('layout' in opts):
            if (not opts['layout']):
                s = 'null'
            else:
                (s, _) = _format_layoutlist(opts['layout'])
            script.append(('ttk::style layout %s {\n%s\n}' % (name, s)))
        if opts.get('element create'):
            eopts = opts['element create']
            etype = eopts[0]
            argc = 1
            while ((argc < len(eopts)) and (not hasattr(eopts[argc], 'iteritems'))):
                argc += 1
            elemargs = eopts[1:argc]
            elemkw = (eopts[argc] if ((argc < len(eopts)) and eopts[argc]) else {
                
            })
            (spec, opts) = _format_elemcreate(etype, True, *elemargs, **elemkw)
            script.append(('ttk::style element create %s %s %s %s' % (name, etype, spec, opts)))
    return '\n'.join(script)

dataset/ETHPy150Open francelabs/datafari/windows/python/Lib/lib-tk/ttk.py _script_from_settings/original