I would like to make an ipywidget floatslider, but passing it a list of values, rather than a range and step. Is there a way to do this, or is making a dropdown widget the only option?
Woops! You can use SelectionSlider, e.g.:
import ipywidgets as widgets
def test(val):
print(val)
widgets.interact(test, val=widgets.SelectionSlider(description='value', options=['1', '50', '300', '7000']))
This widget wasn't available in my ipywidgets 4.0, so I had to upgrade. Also, make sure that afterward you run
jupyter nbextension enable --py --sys-prefix widgetsnbextension
as described in their installation instructions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With