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