MCPcopy Index your code
hub / github.com/python/cpython / _format_optdict

Function _format_optdict

Lib/tkinter/ttk.py:40–54  ·  view source on GitHub ↗

Formats optdict to a tuple to pass it to tk.call. E.g. (script=False): {'foreground': 'blue', 'padding': [1, 2, 3, 4]} returns: ('-foreground', 'blue', '-padding', '1 2 3 4')

(optdict, script=False, ignore=None)

Source from the content-addressed store, hash-verified

38 return value
39
40def _format_optdict(optdict, script=False, ignore=None):
41 """Formats optdict to a tuple to pass it to tk.call.
42
43 E.g. (script=False):
44 {'foreground': 'blue', 'padding': [1, 2, 3, 4]} returns:
45 ('-foreground', 'blue', '-padding', '1 2 3 4')"""
46
47 opts = []
48 for opt, value in optdict.items():
49 if not ignore or opt not in ignore:
50 opts.append("-%s" % opt)
51 if value is not None:
52 opts.append(_format_optvalue(value, script))
53
54 return _flatten(opts)
55
56def _mapdict_values(items):
57 # each value in mapdict is expected to be a sequence, where each item

Callers 8

_format_elemcreateFunction · 0.85
_format_layoutlistFunction · 0.85
_script_from_settingsFunction · 0.85
_val_or_dictFunction · 0.85
addMethod · 0.85
insertMethod · 0.85
insertMethod · 0.85
insertMethod · 0.85

Calls 4

_flattenFunction · 0.90
_format_optvalueFunction · 0.85
itemsMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…