Ipywidget Gridbox no output displayed - PYTHON JUPYTER NOTEBOOK

Viewed 723

I've been going over the Ipywidgets documentation, and found that when ever I use a GridBox, there isn't any output in Jupyter notebook.

https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Styling.html#Shorthand-CSS-properties

Example with this snippet of code below.

from ipywidgets import Button, GridBox, Layout, ButtonStyle

header  = Button(description='Header',
             layout=Layout(width='auto', grid_area='header'),
             style=ButtonStyle(button_color='lightblue'))
main    = Button(description='Main',
             layout=Layout(width='auto', grid_area='main'),
             style=ButtonStyle(button_color='moccasin'))
sidebar = Button(description='Sidebar',
             layout=Layout(width='auto', grid_area='sidebar'),
             style=ButtonStyle(button_color='salmon'))
footer  = Button(description='Footer',
             layout=Layout(width='auto', grid_area='footer'),
             style=ButtonStyle(button_color='olive'))

GridBox(children=[header, main, sidebar, footer],
        layout=Layout(
        width='50%',
        grid_template_rows='auto auto auto',
        grid_template_columns='25% 25% 25% 25%',
        grid_template_areas='''
        "header header header header"
        "main main . sidebar "
        "footer footer footer footer"
        '''))

I don't get any output. Does anyone know why? Many thanks in advance :)

0 Answers
Related