<jupyter_start><jupyter_text>Widget ListThis 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.<jupyter_code>import ipywidgets as widgets

# Show all available widgets!
for item in widgets.Widget.widget_types.items():
    print(item[0][2][:-5])<jupyter_output><empty_output><jupyter_text>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<jupyter_code>widgets.IntSlider(
    value=7,
    min=0,
    max=10,
    step=1,
    description='Test:',
    disabled=False,
    continuous_update=False,
    orientation='horizontal',
    readout=True,
    readout_format='d'
)<jupyter_output><empty_output><jupyter_text>FloatSlider<jupyter_code>widgets.FloatSlider(
    value=7.5,
    min=0,
    max=10.0,
    step=0.1,
    description='Test:',
    disabled=False,
    continuous_update=False,
    orientation='horizontal',
    readout=True,
    readout_format='.1f',
)<jupyter_output><empty_output><jupyter_text>Sliders can also be **displayed vertically**.<jupyter_code>widgets.FloatSlider(
    value=7.5,
    min=0,
    max=10.0,
    step=0.1,
    description='Test:',
    disabled=False,
    continuous_update=False,
    orientation='vertical',
    readout=True,
    readout_format='.1f',
)<jupyter_output><empty_output><jupyter_text>IntRangeSlider<jupyter_code>widgets.IntRangeSlider(
    value=[5, 7],
    min=0,
    max=10,
    step=1,
    description='Test:',
    disabled=False,
    continuous_update=False,
    orientation='horizontal',
    readout=True,
    readout_format='d',
)<jupyter_output><empty_output><jupyter_text>FloatRangeSlider<jupyter_code>widgets.FloatRangeSlider(
    value=[5, 7.5],
    min=0,
    max=10.0,
    step=0.1,
    description='Test:',
    disabled=False,
    continuous_update=False,
    orientation='horizontal',
    readout=True,
    readout_format='.1f',
)<jupyter_output><empty_output><jupyter_text>IntProgress<jupyter_code>widgets.IntProgress(
    value=7,
    min=0,
    max=10,
    step=1,
    description='Loading:',
    bar_style='', # 'success', 'info', 'warning', 'danger' or ''
    orientation='horizontal'
)<jupyter_output><empty_output><jupyter_text>FloatProgress<jupyter_code>widgets.FloatProgress(
    value=7.5,
    min=0,
    max=10.0,
    step=0.1,
    description='Loading:',
    bar_style='info',
    orientation='horizontal'
)<jupyter_output><empty_output><jupyter_text>The numerical text boxes that impose some limit on the data (range, integer-only) impose that restriction when the user presses enter.  BoundedIntText<jupyter_code>widgets.BoundedIntText(
    value=7,
    min=0,
    max=10,
    step=1,
    description='Text:',
    disabled=False
)<jupyter_output><empty_output><jupyter_text>BoundedFloatText<jupyter_code>widgets.BoundedFloatText(
    value=7.5,
    min=0,
    max=10.0,
    step=0.1,
    description='Text:',
    disabled=False
)<jupyter_output><empty_output><jupyter_text>IntText<jupyter_code>widgets.IntText(
    value=7,
    description='Any:',
    disabled=False
)<jupyter_output><empty_output><jupyter_text>FloatText<jupyter_code>widgets.FloatText(
    value=7.5,
    description='Any:',
    disabled=False
)<jupyter_output><empty_output><jupyter_text>Boolean widgets There are three widgets that are designed to display a boolean value.  ToggleButton<jupyter_code>widgets.ToggleButton(
    value=False,
    description='Click me',
    disabled=False,
    button_style='', # 'success', 'info', 'warning', 'danger' or ''
    tooltip='Description',
    icon='check'
)<jupyter_output><empty_output><jupyter_text>Checkbox<jupyter_code>widgets.Checkbox(
    value=False,
    description='Check me',
    disabled=False
)<jupyter_output><empty_output><jupyter_text>ValidThe valid widget provides a read-only indicator.<jupyter_code>widgets.Valid(
    value=False,
    description='Valid!',
)<jupyter_output><empty_output><jupyter_text>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<jupyter_code>widgets.Dropdown(
    options=['1', '2', '3'],
    value='2',
    description='Number:',
    disabled=False,
)<jupyter_output><empty_output><jupyter_text>The following is also valid:<jupyter_code>widgets.Dropdown(
    options={'One': 1, 'Two': 2, 'Three': 3},
    value=2,
    description='Number:',
)<jupyter_output><empty_output><jupyter_text>RadioButtons<jupyter_code>widgets.RadioButtons(
    options=['pepperoni', 'pineapple', 'anchovies'],
    # value='pineapple',
    description='Pizza topping:',
    disabled=False
)<jupyter_output><empty_output><jupyter_text>Select<jupyter_code>widgets.Select(
    options=['Linux', 'Windows', 'OSX'],
    value='OSX',
    # rows=10,
    description='OS:',
    disabled=False
)<jupyter_output><empty_output><jupyter_text>SelectionSlider<jupyter_code>widgets.SelectionSlider(
    options=['scrambled', 'sunny side up', 'poached', 'over easy'],
    value='sunny side up',
    description='I like my eggs ...',
    disabled=False,
    continuous_update=False,
    orientation='horizontal',
    readout=True
)<jupyter_output><empty_output><jupyter_text>SelectionRangeSliderThe value, index, and label keys are 2-tuples of the min and max values selected. The options must be nonempty.<jupyter_code>import datetime
dates = [datetime.date(2015,i,1) for i in range(1,13)]
options = [(i.strftime('%b'), i) for i in dates]
widgets.SelectionRangeSlider(
    options=options,
    index=(0,11),
    description='Months (2015)',
    disabled=False
)<jupyter_output><empty_output><jupyter_text>ToggleButtons<jupyter_code>widgets.ToggleButtons(
    options=['Slow', 'Regular', 'Fast'],
    description='Speed:',
    disabled=False,
    button_style='', # 'success', 'info', 'warning', 'danger' or ''
    tooltips=['Description of slow', 'Description of regular', 'Description of fast'],
    # icons=['check'] * 3
)<jupyter_output><empty_output><jupyter_text>SelectMultipleMultiple values can be selected with shift and/or ctrl (or command) pressed and mouse clicks or arrow keys.<jupyter_code>widgets.SelectMultiple(
    options=['Apples', 'Oranges', 'Pears'],
    value=['Oranges'],
    # rows=10,
    description='Fruits',
    disabled=False
)<jupyter_output><empty_output><jupyter_text>String widgetsThere 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<jupyter_code>widgets.Text(
    value='Hello World',
    placeholder='Type something',
    description='String:',
    disabled=False
)<jupyter_output><empty_output><jupyter_text>Textarea<jupyter_code>widgets.Textarea(
    value='Hello World',
    placeholder='Type something',
    description='String:',
    disabled=False
)<jupyter_output><empty_output><jupyter_text>LabelThe `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.<jupyter_code>widgets.HBox([widgets.Label(value="The $m$ in $E=mc^2$:"), widgets.FloatSlider()])<jupyter_output><empty_output><jupyter_text>HTML<jupyter_code>widgets.HTML(
    value="Hello <b>World</b>",
    placeholder='Some HTML',
    description='Some HTML',
)<jupyter_output><empty_output><jupyter_text>HTML Math<jupyter_code>widgets.HTMLMath(
    value=r"Some math and <i>HTML</i>: \(x^2\) and $$\frac{x+1}{x-1}$$",
    placeholder='Some HTML',
    description='Some HTML',
)<jupyter_output><empty_output><jupyter_text>Image<jupyter_code>file = open("images/WidgetArch.png", "rb")
image = file.read()
widgets.Image(
    value=image,
    format='png',
    width=300,
    height=400,
)<jupyter_output><empty_output><jupyter_text>Button<jupyter_code>widgets.Button(
    description='Click me',
    disabled=False,
    button_style='', # 'success', 'info', 'warning', 'danger' or ''
    tooltip='Click me',
    icon='check'
)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12730299667036626, 'fraction_numerical': 0.012430632630410655, 'mean_word_length': 5.395315826827537, 'pattern_counts': {'":': 0, '<': 125, '<?xml version=': 0, '>': 125, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '30', 'dir': 'jupyter-structured-clean-dedup', 'id': '469383', 'license': 'Apache-2.0', 'n_tokens_mistral': 3045, 'n_tokens_neox': 2930, 'n_words': 667, 'path': '16-Bonus Material - Introduction to GUIs/03-Widget List.ipynb', 'repo_name': 'vjsniper/Python', 'size': '9010'}