Search code examples
python-3.xjupyter-notebookipywidgets

Changing the layout of the ipython widgets toggle buttons


These are the buttons that I'm trying to customize: toggle buttons from ipywidgets

The code itself.


This is the result I want to get (edited by GIMP):

edit


I want to keep these buttons stacked vertically (as shown in the edited image I made), but since I don't know much about CSS, I don't know how to do that. Any suggestion?


Solution

  • As Bananach said, layout=widgets.Layout(width='100px') will do it.

    widgets.ToggleButtons(
        options=['A','B', 'C'],
        disabled=False,
        button_style='info', # 'success', 'info', 'warning', 'danger' or ''
        layout=widgets.Layout(width='100px')
        #     icons=['check'] * 3
    )
    

    enter image description here