SVG Layout

HTML is not ideal for arbitrary layouts. Let's make a wireframe in Inkscape, the free software illustration program. Here's what we made:


In [20]:
from ipywidgets import widgets as W
import traitlets as T
from IPython.display import display as show

from ipylayoutwidgets import widgets as DW

Let's add it as a layout layer. Here, we specify an svg_file rather than loading it ourselves, because of the tricky © character.


In [21]:
dashboard = DW.FullscreenBox()

button = W.Button(description="Click me")

regions = dict(
    sidebar=button
)

layout = DW.SVGLayoutBox(
    svg_file="layout.svg",
    widget_map=regions,
    children=list(regions.values())
)

dashboard.children = [layout]

In [22]:
dashboard

In [23]:
def click(foo):
    button.description += "!"

In [24]:
button.on_click(click)