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/03-Widget List.ipynb
Views: 648
Widget List
This lecture will serve as a reference for widgets, providing a list of the GUI widgets available!
Complete list
For a complete list of the GUI widgets available to you, you can list the registered widget types. Widget
is the base class.
Numeric widgets
There are 10 widgets distributed with IPython that are designed to display numeric values. Widgets exist for displaying integers and floats, both bounded and unbounded. The integer widgets share a similar naming scheme to their floating point counterparts. By replacing Float
with Int
in the widget name, you can find the Integer equivalent.
IntSlider
FloatSlider
Sliders can also be displayed vertically.
IntRangeSlider
FloatRangeSlider
IntProgress
FloatProgress
The numerical text boxes that impose some limit on the data (range, integer-only) impose that restriction when the user presses enter.
BoundedIntText
BoundedFloatText
IntText
FloatText
Boolean widgets
There are three widgets that are designed to display a boolean value.
ToggleButton
Checkbox
Valid
The valid widget provides a read-only indicator.
Selection widgets
There are several widgets that can be used to display single selection lists, and two that can be used to select multiple values. All inherit from the same base class. You can specify the enumeration of selectable options by passing a list (options are either (label, value) pairs, or simply values for which the labels are derived by calling str
). You can also specify the enumeration as a dictionary, in which case the keys will be used as the item displayed in the list and the corresponding value will be used when an item is selected (in this case, since dictionaries are unordered, the displayed order of items in the widget is unspecified).
Dropdown
The following is also valid:
RadioButtons
Select
SelectionSlider
SelectionRangeSlider
The value, index, and label keys are 2-tuples of the min and max values selected. The options must be nonempty.
ToggleButtons
SelectMultiple
Multiple values can be selected with shift and/or ctrl (or command) pressed and mouse clicks or arrow keys.
String widgets
There are several widgets that can be used to display a string value. The Text
and Textarea
widgets accept input. The HTML
and HTMLMath
widgets display a string as HTML (HTMLMath
also renders math). The Label
widget can be used to construct a custom control label.
Text
Textarea
Label
The Label
widget is useful if you need to build a custom description next to a control using similar styling to the built-in control descriptions.
HTML
HTML Math
Image
Button
Conclusion
Even more widgets are described in the notebook Widget List - Advanced. Use these as a future reference for yourself!