Jupyter Interactive widgets

The notebook comes alive with the interactive widgets:

  • Part of the Jupyter project
  • BSD Licensed

Installation for the legacy notebook:

conda install -c conda-forge ipywidgets

Speeding up the bottleneck in the REPL


In [1]:
9 * 9


Out[1]:
81

In [2]:
def f(x):
    print(x * x)

In [3]:
f(9)


81

In [4]:
from ipywidgets import *
from traitlets import dlink

In [5]:
interact(f, x=(0, 100));


Interactive Jupyter widgets


In [6]:
slider = FloatSlider(
    value=7.5,
    min=5.0,
    max=10.0,
    step=0.1,
    description='Input:',
)

slider



In [7]:
slider



In [8]:
slider.value


Out[8]:
7.5

In [9]:
text = FloatText(description='Value')
dlink((slider, 'value'), (text, 'value'))
text



In [10]:
slider


Widgets are represented in the back-end by a single object. Each time a widget is displayed, a new representation of that same object is created in the front-end. These representations are called views.

Jupyter widgets as a framework

  • bqplot
  • ipyleaflet
  • pythreejs

In [ ]: