Reputation: 415
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'
)
Upvotes: 4
Views: 9332
Reputation: 700
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)
Upvotes: 12