Reputation: 1295
No matter what I do, it seems the smallest width of an ipywidgets.Checkbox
is 100px. Anything smaller and the widget doesn't show. It seems a waste of space when grouping with other widgets in an ipywidgets.HBox
import ipywidgets as ipyw
ly = dict(margin='0px', border='solid', max_width='100px')
w = ipyw.Checkbox(value=True, layout=ly)
display(w)
Also the widget is right-justified by default. I didn't figure out how to change the justification.
Has anyone come up with a way to decrease the occupying space?
Upvotes: 1
Views: 2881
Reputation: 613
There is an option "indent". Set it to "False".
from ipywidgets import HBox, Checkbox
checkbox501 = Checkbox(True, description='501', indent=False, layout=Layout(width='50px', height='50px'))
checkbox502 = Checkbox(False, description='502')
HBox([checkbox501, checkbox502], layout=Layout(width='850px', height='80px'))
Upvotes: 7