Construct a list from the tuple returned by ttk::layout, this is somewhat the reverse of _format_layoutlist.
(tk, ltuple)
| 247 | return result |
| 248 | |
| 249 | def _list_from_layouttuple(tk, ltuple): |
| 250 | """Construct a list from the tuple returned by ttk::layout, this is |
| 251 | somewhat the reverse of _format_layoutlist.""" |
| 252 | ltuple = tk.splitlist(ltuple) |
| 253 | res = [] |
| 254 | |
| 255 | indx = 0 |
| 256 | while indx < len(ltuple): |
| 257 | name = ltuple[indx] |
| 258 | opts = {} |
| 259 | res.append((name, opts)) |
| 260 | indx += 1 |
| 261 | |
| 262 | while indx < len(ltuple): # grab name's options |
| 263 | opt, val = ltuple[indx:indx + 2] |
| 264 | if not opt.startswith('-'): # found next name |
| 265 | break |
| 266 | |
| 267 | opt = opt[1:] # remove the '-' from the option |
| 268 | indx += 2 |
| 269 | |
| 270 | if opt == 'children': |
| 271 | val = _list_from_layouttuple(tk, val) |
| 272 | |
| 273 | opts[opt] = val |
| 274 | |
| 275 | return res |
| 276 | |
| 277 | def _val_or_dict(tk, options, *args): |
| 278 | """Format options then call Tk command with args and options and return |
no test coverage detected
searching dependent graphs…