Installing widgets
- The widgets package is an upgrade to the standard Jupyter installation. You can update the widgets package using this command:
pip install ipywidgets
- Once complete, you must then upgrade your Jupyter installation using this command:
jupyter nbextension enable --py widgetsnbextension
- And then you must use this command:
conda update jupyter_core jupyter_client
- We put together a basic example widget Notebook to make sure everything is working:
#import our librariesfrom ipywidgets import *from IPython.display import display#create a slider and message boxslider = widgets.FloatSlider()message = widgets.Text(value = 'Hello World')#add them to the containercontainer = widgets.Box(children = (slider, message))container.layout.border = '1px black solid'display(container)
- We end up with the following screenshot, where the container widget is displayed enclosing the slider and the message box: