Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/19-Bonus Material - Introduction to GUIs/07-Advanced Widget List.ipynb
Views: 648
Advanced Widget List
This notebook is an extension of Widget List, describing even more of the GUI widgets available!
Output
The Output
widget can capture and display stdout, stderr and rich output generated by IPython. After the widget is created, direct output to it using a context manager.
You can print text to the output area as shown below.
Rich material can also be directed to the output area. Anything which displays nicely in a Jupyter notebook will also display well in the Output
widget.
Play (Animation) widget
The Play
widget is useful to perform animations by iterating on a sequence of integers with a certain speed. The value of the slider below is linked to the player.
Date picker
The date picker widget works in Chrome and IE Edge, but does not currently work in Firefox or Safari because they do not support the HTML date input field.
Color picker
Controller
The Controller
allows a game controller to be used as an input device.
Container/Layout widgets
These widgets are used to hold other widgets, called children. Each has a children
property that may be set either when the widget is created or later.
Box
HBox
VBox
Accordion
Tabs
In this example the children are set after the tab is created. Titles for the tabes are set in the same way they are for Accordion
.
Accordion and Tab use selected_index
, not value
Unlike the rest of the widgets discussed earlier, the container widgets Accordion
and Tab
update their selected_index
attribute when the user changes which accordion or tab is selected. That means that you can both see what the user is doing and programmatically set what the user sees by setting the value of selected_index
.
Setting selected_index = None
closes all of the accordions or deselects all tabs.
In the cells below try displaying or setting the selected_index
of the tab
and/or accordion
.
Nesting tabs and accordions
Tabs and accordions can be nested as deeply as you want. If you have a few minutes, try nesting a few accordions or putting an accordion inside a tab or a tab inside an accordion.
The example below makes a couple of tabs with an accordion children in one of them
Conclusion
Use this as a further reference for yourself!