Skip to content

Note

Click here to download the full example code

Multiple selection widget#

A selection widget allowing multiple selections by the user.

selection

Out:

<FunctionGui my_widget(pick_some=['first'])>


from magicgui import magicgui


@magicgui(
    pick_some={
        "choices": ("first", "second", "third", "fourth"),
        "allow_multiple": True,
    }
)
def my_widget(pick_some=("first")):
    """Dropdown selection function."""
    print("you selected", pick_some)


my_widget.show(run=True)

Total running time of the script: ( 0 minutes 0.038 seconds)

Download Python source code: selection.py

Download Jupyter notebook: selection.ipynb

Gallery generated by mkdocs-gallery