Lucas Mengual
Lucas Mengual

Reputation: 415

Align ipywidget button to center

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

Answers (2)

Vishma Dias
Vishma Dias

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

Viktor Mohos
Viktor Mohos

Reputation: 1

Try to use table ,maybe you can find some help here

Upvotes: 0

Related Questions