A7sharp11
A7sharp11

Reputation: 123

Obtaining values from ipywidgets.widgets.SelectMultiple

I am not able to get the values from a MultipleSelect widget after changing the initial selection. The selection looks fine, but the values do not show. The code to create the SelectMultiple widget:

from ipywidgets import widgets
from IPython.display import display
w = widgets.SelectMultiple(description="Fruits",
options=['Apples', 'Oranges', 'Pears'])
display(w)

The selection widget appears as expected, and if nothing is done with it, a subsequent w.value correctly returns the visual selection (for me, this is the last option, 'Pears'). However, after making a selection by mouse (say, selecting 'Apples' or 'Apples' and 'Oranges'), w.value returns an empty tuple.

The exact same code with widgets.SelectMultiple replaced with widgets.Dropdown works as expected (w.value showing the selected value, also after changing the selection).

What am I doing wrong?

Upvotes: 4

Views: 5810

Answers (1)

A7sharp11
A7sharp11

Reputation: 123

I believe it to be a browser issue. I usually use Chrome, where it works just fine. Today, I used IE11, and whereas all other ipywidgets.widgets worked as expected, the widgets.SelectMultiple does not.

Upvotes: 2

Related Questions