Index - Back - Next

Widget List

Complete list

For a complete list of the GUI widgets available to you, you can list the registered widget types. Widget and DOMWidget, not listed below, are base classes.

In [1]:
import ipywidgets as widgets
widgets.Widget.widget_types.values()
Out[1]:
dict_values([<class 'ipywidgets.widgets.widget_selection.Dropdown'>, <class 'ipywidgets.widgets.widget_image.Image'>, <class 'ipywidgets.widgets.widget_string.Textarea'>, <class 'ipywidgets.widgets.widget_int.IntText'>, <class 'ipywidgets.widgets.widget_selectioncontainer.Tab'>, <class 'ipywidgets.widgets.widget_box.Proxy'>, <class 'ipywidgets.widgets.widget_selection.RadioButtons'>, <class 'ipywidgets.widgets.widget_string.Text'>, <class 'ipywidgets.widgets.widget_controller.Controller'>, <class 'ipywidgets.widgets.widget_int.BoundedIntText'>, <class 'ipywidgets.widgets.widget_color.ColorPicker'>, <class 'ipywidgets.widgets.widget_selection.ToggleButtons'>, <class 'ipywidgets.widgets.widget_selection.SelectionSlider'>, <class 'ipywidgets.widgets.widget_bool.Checkbox'>, <class 'ipywidgets.widgets.widget_box.PlaceProxy'>, <class 'ipywidgets.widgets.widget_string.HTML'>, <class 'ipywidgets.widgets.widget_bool.ToggleButton'>, <class 'ipywidgets.widgets.widget_float.FloatRangeSlider'>, <class 'ipywidgets.widgets.widget_button.Button'>, <class 'ipywidgets.widgets.widget_box.Box'>, <class 'ipywidgets.widgets.widget_box.FlexBox'>, <class 'ipywidgets.widgets.widget_selectioncontainer.Accordion'>, <class 'ipywidgets.widgets.widget_int.IntProgress'>, <class 'ipywidgets.widgets.widget_float.FloatText'>, <class 'ipywidgets.widgets.widget_controller.Button'>, <class 'ipywidgets.widgets.widget_selection.Select'>, <class 'ipywidgets.widgets.widget_float.BoundedFloatText'>, <class 'ipywidgets.widgets.widget_selection.SelectMultiple'>, <class 'ipywidgets.widgets.widget_float.FloatSlider'>, <class 'ipywidgets.widgets.widget_controller.Axis'>, <class 'ipywidgets.widgets.widget_int.IntSlider'>, <class 'ipywidgets.widgets.widget_string.Latex'>, <class 'ipywidgets.widgets.widget_int.IntRangeSlider'>, <class 'ipywidgets.widgets.widget_float.FloatProgress'>, <class 'ipywidgets.widgets.widget_bool.Valid'>])

Numeric widgets

There are 8 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.

FloatSlider

In [2]:
widgets.FloatSlider(
    value=7.5,
    min=5.0,
    max=10.0,
    step=0.1,
    description='Test:',
)
_images/test_8_0.png

Sliders can also be displayed vertically.

In [3]:
widgets.FloatSlider(
    value=7.5,
    min=5.0,
    max=10.0,
    step=0.1,
    description='Test',
    orientation='vertical',
)
_images/test_10_0.png

FloatProgress

In [4]:
widgets.FloatProgress(
    value=7.5,
    min=5.0,
    max=10.0,
    step=0.1,
    description='Loading:',
)
_images/test_12_0.png

BoundedFloatText

In [5]:
widgets.BoundedFloatText(
    value=7.5,
    min=5.0,
    max=10.0,
    description='Text:',
)
_images/test_14_0.png

FloatText

In [6]:
widgets.FloatText(
    value=7.5,
    description='Any:',
)
_images/test_16_0.png

Boolean widgets

There are three widgets that are designed to display a boolean value.

ToggleButton

In [7]:
widgets.ToggleButton(
    description='Click me',
    value=False,
)
_images/test_20_0.png

Checkbox

In [8]:
widgets.Checkbox(
    description='Check me',
    value=True,
)
_images/test_22_0.png

Valid

The valid widget provides a read-only indicator.

In [9]:
widgets.Valid(
    value=True,
)
_images/test_24_0.png

Selection widgets

There are four widgets that can be used to display single selection lists, and one that can be used to display multiple selection lists. All inherit from the same base class. You can specify the enumeration of selectable options by passing a list. 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 returned when an item is selected.

RadioButtons

In [18]:
widgets.RadioButtons(
    description='Pizza topping:',
    options=['pepperoni', 'pineapple', 'anchovies'],
)
_images/test_40_0.png

Select

In [19]:
widgets.Select(
    description='OS:',
    options=['Linux', 'Windows', 'OSX'],
)
_images/test_42_0.png

SelectionSlider

In [20]:
widgets.SelectionSlider(
    description='I like my eggs ...',
    options=['scrambled', 'sunny side up', 'poached', 'over easy'],
)
_images/test_44_0.png

ToggleButtons

In [21]:
widgets.ToggleButtons(
    description='Speed:',
    options=['Slow', 'Regular', 'Fast'],
)
_images/test_46_0.png

SelectMultiple

Multiple values can be selected with shift and/or ctrl (or command) pressed and mouse clicks or arrow keys.

In [22]:
w = widgets.SelectMultiple(
    description="Fruits",
    options=['Apples', 'Oranges', 'Pears']
)
display(w)
_images/test_48_0.png
In [23]:
w.value
Out[23]:
('Apples',)

String widgets

There are 4 widgets that can be used to display a string value. Of those, the Text and Textarea widgets accept input. The Latex and HTML widgets display the string as either Latex or HTML respectively, but do not accept input.

Text

In [24]:
widgets.Text(
    description='String:',
    value='Hello World',
)
_images/test_53_0.png

Textarea

In [25]:
widgets.Textarea(
    description='String:',
    value='Hello World',
)
_images/test_55_0.png

Latex

In [26]:
widgets.Latex(
    value="$$\\frac{n!}{k!(n-k)!} = \\binom{n}{k}$$",
)
_images/test_57_0.png

HTML

In [27]:
widgets.HTML(
    value="Hello <b>World</b>"
)
_images/test_59_0.png

Button

In [28]:
widgets.Button(description='Click me')
_images/test_61_0.png

Index - Back - Next