I'm trying to create a Jupyter Notebook to help some colleagues interactively access some data. I want to give them a bunch of widgets that allow them to use different criteria to filter the data.
Mainly it works beautifully, but I can't adjust the spacing between two widgets, and it's going to drive me nuts.
I've tried following the instructions here, but the two buttons are always right next to each other.
class Dashboard(object):
def __init__(self):
item_layout = Layout(flex='1 1 auto',
width='auto')
toggle = widgets.ToggleButtons(
options=["Foo", "Bar"],
value="Foo",
description="Foobar:",
disable=False,
layout=item_layout,
)
check = widgets.Checkbox(
value=True,
description="Checked",
disabled=False,
layout=item_layout,
)
box_layout = Layout(display='flex',
flex_flow='row',
justify_content='space around',
width='500px',
button_layout='solid',
)
buttons = widgets.Box(children=[
widgets.interactive(self._set_foobar, foobar=toggle, layout=item_layout),
widgets.interactive(self._set_checked, checked=check, layout=item_layout),
],
layout=box_layout)
display(buttons)
def _set_foobar(self, foobar):
self._foo = foobar == 'Foo'
def _set_checked(self, checked):
self._checked = bool(checked)
If I then open up a Jupyter notebook and do:
import dashboard
y = dashboard.Dashboard()
It produces:
If I don't make the widgets interactive i.e. children=[toggle, check]
it works perfectly.
Is there a way that I can adjust the space between interactive widgets?