Ipywidgets: Multiple selection ToggleButtons

Created on 18 Aug 2016  路  9Comments  路  Source: jupyter-widgets/ipywidgets

Now there is only a single widget which allows multiple selection - selection list. Often toggle buttons suit better, but in ipywidgets they allow to select single item only. While it's not that difficult to make a similar widget manually using a box and separate ToggleButtons (+ a bit of custom CSS), having this out of the box would be great!

feature request

Most helpful comment

@hainm I mean that such a widget is of very general use, and in some common cases better (e.g. takes less vertical space - just a single line - compared to selection list, which is currently the only multiple selection widget; also can be operated with mouse only - through that's a minor thing). And there are single-selection ToggleButtons already, so why not include such an obvious generalization?

And as for implementing it on top of ipywidgets see here for my version (in pure python, I don't feel like messing with widgets templates).

All 9 comments

While it's not that difficult to make a similar widget manually using a box and separate ToggleButtons (+ a bit of custom CSS), having this out of the box would be great!

can you say more about this, like why 'great' (just curious).

@hainm I mean that such a widget is of very general use, and in some common cases better (e.g. takes less vertical space - just a single line - compared to selection list, which is currently the only multiple selection widget; also can be operated with mouse only - through that's a minor thing). And there are single-selection ToggleButtons already, so why not include such an obvious generalization?

And as for implementing it on top of ipywidgets see here for my version (in pure python, I don't feel like messing with widgets templates).

thanks.

@aplavin We invite you to submit a PR to add a ToggleButtons widget!

@gnestor as I understand, the widgets in ipywidgets are implemented with javascript (custom templates), not python-only. I haven't wrapped my head around this, so I can't implement the widget the same way as existing widgets are.

If that's OK, I can clean up my code a bit and add it to widget_selection.py.

@aplavin I will help with this. Feel free to submit an initial PR with the Python code. If you do, check the "Allow maintainers to edit" checkbox and I will work on the Javascript side.

Hi all,

came across this while trying to find the feature - has this been implemented?

What ever happened here? Would love this feature built in

@jtdowdall - It looks like @maartenbreddels is starting up some conversation at #2228 inspired by this.

Was this page helpful?
0 / 5 - 0 ratings