Format options then call Tk command with args and options and return the appropriate result. If no option is specified, a dict is returned. If an option is specified with the None value, the value for that option is returned. Otherwise, the function just sets the passed options and
(tk, options, *args)
| 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 |
| 279 | the appropriate result. |
| 280 | |
| 281 | If no option is specified, a dict is returned. If an option is |
| 282 | specified with the None value, the value for that option is returned. |
| 283 | Otherwise, the function just sets the passed options and the caller |
| 284 | shouldn't be expecting a return value anyway.""" |
| 285 | options = _format_optdict(options) |
| 286 | res = tk.call(*(args + options)) |
| 287 | |
| 288 | if len(options) % 2: # option specified without a value, return its value |
| 289 | return res |
| 290 | |
| 291 | return _splitdict(tk, res, conv=_tclobj_to_py) |
| 292 | |
| 293 | def _convert_stringval(value): |
| 294 | """Converts a value to, hopefully, a more appropriate Python object.""" |