Often, you want the user to choose n options (where n is small-ish) from a very large (hundreds or thousands) number of possibilities. Good UX around this dictates that the user should be able to search for the options they want.
This gist puts together a minimal example of binding a search field with multiple checkboxes using ipywidgets.
widget = multi_checkbox_widget(['hello', 'world'])
widget # Display the widget
To get the selected options:
selected_options = [widget.description for widget in w.children[1].children if widget.value]
-
This is in need of some layout/CSS TLC.
-
At the moment, we just use difflib from the standard library for searching through the options. It mostly works, but I don't think it's what difflib is supposed to be used as. Using a different search algorithm might lead to better results.
Selected options are obtained with: