Suggestion: Allow callables as choices for ChoiceWidgets
fiee opened this issue · 1 comments
Just a feature request. I’m working on a config-driven dialog setup, and would like to get the list of choices for e.g. comboboxes as late as possible.
Any ChoiceWidget, unlikely. For example, why bother with that for WRadioButton, the idea is that it should be pretty static.
But for WListBox, its subclasses and composite widgets using it, it of course makes sense.
The current approach to that (which is in no way API-stable) is subclassing it, and overriding show_line() method. That deals with adjusting "V" (view) part of MVC. I actually never had a need to adjust "M" (model), it's set to be a list. But with Python's power, you can pass any object which implements __getitem__
method to .set_lines().
You're welcome to play with it and provide feedback.