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

Function _list_from_layouttuple

Lib/tkinter/ttk.py:249–275  ·  view source on GitHub ↗

Construct a list from the tuple returned by ttk::layout, this is somewhat the reverse of _format_layoutlist.

(tk, ltuple)

Source from the content-addressed store, hash-verified

247 return result
248
249def _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
277def _val_or_dict(tk, options, *args):
278 """Format options then call Tk command with args and options and return

Callers 1

layoutMethod · 0.85

Calls 3

splitlistMethod · 0.80
appendMethod · 0.45
startswithMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…