I currently am using the selectmultiple widget in ipywidgets and I'm looking for a better solution. I have 200+ countries that a user can select from and sometimes they want to SELECT ALL. Using this widget they need to click on each and every country and this is very time consuming. Does anyone have another suggestion or option that I can try. Any help would be much appreciated.
widgets.SelectMultiple(
options=['Afghanistan',
'Aland Islands',
'Albania'
'Algeria',
#Code continues for 249 countries
],
value=['Afghanistan'],
#rows=10,
description='Countries',
disabled=False
)
Thanks
You can use CMD+A in Mac to select all in the usual way, imagine CTRL+A will work for Windows too.
But if you need a widget, how about a button next to it that performs the same action?
import ipywidgets as widgets
sel = widgets.SelectMultiple(
options=['Afghanistan',
'Aland Islands',
'Albania',
'Algeria',
#Code continues for 249 countries
],
value=['Afghanistan'],
#rows=10,
description='Countries',
disabled=False
)
but = widgets.Button(description = 'Select all')
def select_all(*args):
sel.value = sel.options
but.on_click(select_all)
display(sel)
display(but)