I'm creating an interactive jupyter notebook with ipython widgets and want the user to select from a certain number of checkboxes. I'm using the code below to visualize the HBox that contains the checkboxes.
num_checks = 10
cb_cont = widgets.HBox(background_color='red',height='100px',width='100%')
checkboxes = []
for f in range(num_checks):
checkboxes.append(\
widgets.Checkbox(description = 'Checkbox [%d]'%(f), \
value=False, width=50))
cb_cont.children=[i for i in checkboxes]
display(cb_cont)
Here is a screenshot of the output from the above code:
As you can see, the content of the box overflows and goes beyond the width of the container.
I can change the behavior by setting the overflow_x property to be one of the following: ['visible', 'hidden', 'scroll', 'auto', 'initial', 'inherit', ''].
For instance, cb_cont.overflow_x = 'scroll' results in the following output window:
in which the content doesn't overflow but becomes invisible and can be scrolled.
How can I set the property of the box to visualize the content that does not fit on a newline?
Obviously I could use multiple HBox objects each one containing the maximum number of checkboxes that fit in a window size, however this is not the wanted solution for a set of reasons:
- Depending on the screen resolution that number could change.
- The number of checkboxes to pick from depends on a previous computation ans is not known it in advance.

