I´m looking to align to the center a button object from the ipywidget function. Here´s a sample of the code I´m using
bt = widgets.Button(layout=Layout(width='180px'),style =
{'description_width': '25%'})
b_config_save = widgets.Button(
description="Save",
layout=bt.layout,
style=bt.style,
button_style='primary'
)
Use a flexbox layout as shown below.
btn = widgets.Button(description="Save")
box_layout = widgets.Layout(display='flex',
flex_flow='column',
align_items='center',
width='50%')
box = widgets.HBox(children=[btn],layout=box_layout)
display(box)
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