Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Allow callables as choices for ChoiceWidgets #28

Open
fiee opened this issue Jan 21, 2018 · 1 comment
Open

Suggestion: Allow callables as choices for ChoiceWidgets #28

fiee opened this issue Jan 21, 2018 · 1 comment

Comments

@fiee
Copy link

fiee commented Jan 21, 2018

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.

@pfalcon
Copy link
Owner

pfalcon commented Jan 22, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants