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