MCPcopy Index your code
hub / github.com/RustPython/RustPython / _list_from_layouttuple

Function _list_from_layouttuple

Lib/tkinter/ttk.py:251–277  ·  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

249 return result
250
251def _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
279def _val_or_dict(tk, options, *args):
280 """Format options then call Tk command with args and options and return

Callers 1

layoutMethod · 0.85

Calls 3

lenFunction · 0.85
appendMethod · 0.45
startswithMethod · 0.45

Tested by

no test coverage detected