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

Provide more direct "autowidget generation" without requiring function body. #7

Closed
tlambert03 opened this issue Mar 25, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@tlambert03
Copy link
Member

tlambert03 commented Mar 25, 2020

in using magicgui to create a single widget in napari/napari#1069, even though they didn't a function with logic in the body, there was no choice but to do:

@magicgui(label={'choices': labels})
def label_selection(label):
    return label

while the original conception of magicgui was to provide a GUI for simple functions, this makes me think that we should also offer one-off widgets that still abstract away the widget backend (one shouldn't need to know any Qt methods if they don't want to), while having a bit more direct access to Type->Widget lookups. something like:

label_selection = magicgui.make_widget(choices=labels)
@tlambert03
Copy link
Member Author

Possible now. #43 introduced both magicgui.widgets.create_widget as well as the direct widget creation API

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

No branches or pull requests

1 participant