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)
| 38 | return value |
| 39 | |
| 40 | def _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 | |
| 56 | def _mapdict_values(items): |
| 57 | # each value in mapdict is expected to be a sequence, where each item |
no test coverage detected
searching dependent graphs…