Skip to content

Instantly share code, notes, and snippets.

@jtpio
Last active May 26, 2021 14:29
Show Gist options
  • Save jtpio/8d392846c2f3ee6fab38cdfab5a364ec to your computer and use it in GitHub Desktop.
Save jtpio/8d392846c2f3ee6fab38cdfab5a364ec to your computer and use it in GitHub Desktop.
JupyterLab 3.0.16 on Binder

JupyterLab 3.0 on Binder

Try it on Binder!

Binder

This conda environment demonstrates how to install JupyterLab extensions with conda or mamba, without any end user build or requiring Node.js.

It also installs the xeus-python kernel to enable the visual debugger sidebar by default.

And Jupyter Widgets!

image

name: jupyterlab-3
channels:
- conda-forge
dependencies:
- ipywidgets=7.6
- jupyterlab=3.0.16
- jupyterlab-python-file # JupyterLab extension installed with conda (no end user build)
- xeus-python
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Widget List"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import ipywidgets as widgets"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Numeric widgets"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"There are many widgets distributed with ipywidgets 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."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### IntSlider"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.IntSlider(\n",
" value=7,\n",
" min=0,\n",
" max=10,\n",
" step=1,\n",
" description='Test:',\n",
" disabled=False,\n",
" continuous_update=False,\n",
" orientation='horizontal',\n",
" readout=True,\n",
" readout_format='d'\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"### FloatSlider"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.FloatSlider(\n",
" value=7.5,\n",
" min=0,\n",
" max=10.0,\n",
" step=0.1,\n",
" description='Test:',\n",
" disabled=False,\n",
" continuous_update=False,\n",
" orientation='horizontal',\n",
" readout=True,\n",
" readout_format='.1f',\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Sliders can also be **displayed vertically**."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.FloatSlider(\n",
" value=7.5,\n",
" min=0,\n",
" max=10.0,\n",
" step=0.1,\n",
" description='Test:',\n",
" disabled=False,\n",
" continuous_update=False,\n",
" orientation='vertical',\n",
" readout=True,\n",
" readout_format='.1f',\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### FloatLogSlider"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The `FloatLogSlider` has a log scale, which makes it easy to have a slider that covers a wide range of positive magnitudes. The `min` and `max` refer to the minimum and maximum exponents of the `base`, and the `value` refers to the actual value of the slider."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.FloatLogSlider(\n",
" value=10,\n",
" base=10,\n",
" min=-10, # max exponent of base\n",
" max=10, # min exponent of base\n",
" step=0.2, # exponent step\n",
" description='Log Slider'\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### IntRangeSlider"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.IntRangeSlider(\n",
" value=[5, 7],\n",
" min=0,\n",
" max=10,\n",
" step=1,\n",
" description='Test:',\n",
" disabled=False,\n",
" continuous_update=False,\n",
" orientation='horizontal',\n",
" readout=True,\n",
" readout_format='d',\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### FloatRangeSlider"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.FloatRangeSlider(\n",
" value=[5, 7.5],\n",
" min=0,\n",
" max=10.0,\n",
" step=0.1,\n",
" description='Test:',\n",
" disabled=False,\n",
" continuous_update=False,\n",
" orientation='horizontal',\n",
" readout=True,\n",
" readout_format='.1f',\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### IntProgress"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.IntProgress(\n",
" value=7,\n",
" min=0,\n",
" max=10,\n",
" step=1,\n",
" description='Loading:',\n",
" bar_style='', # 'success', 'info', 'warning', 'danger' or ''\n",
" orientation='horizontal'\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"### FloatProgress"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.FloatProgress(\n",
" value=7.5,\n",
" min=0,\n",
" max=10.0,\n",
" step=0.1,\n",
" description='Loading:',\n",
" bar_style='info',\n",
" orientation='horizontal'\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The numerical text boxes that impose some limit on the data (range, integer-only) impose that restriction when the user presses enter.\n",
"\n",
"### BoundedIntText"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.BoundedIntText(\n",
" value=7,\n",
" min=0,\n",
" max=10,\n",
" step=1,\n",
" description='Text:',\n",
" disabled=False\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"### BoundedFloatText"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.BoundedFloatText(\n",
" value=7.5,\n",
" min=0,\n",
" max=10.0,\n",
" step=0.1,\n",
" description='Text:',\n",
" disabled=False\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### IntText"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.IntText(\n",
" value=7,\n",
" description='Any:',\n",
" disabled=False\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"### FloatText"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.FloatText(\n",
" value=7.5,\n",
" description='Any:',\n",
" disabled=False\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Boolean widgets"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"There are three widgets that are designed to display a boolean value."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### ToggleButton"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.ToggleButton(\n",
" value=False,\n",
" description='Click me',\n",
" disabled=False,\n",
" button_style='', # 'success', 'info', 'warning', 'danger' or ''\n",
" tooltip='Description',\n",
" icon='check'\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"### Checkbox"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.Checkbox(\n",
" value=False,\n",
" description='Check me',\n",
" disabled=False\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Valid\n",
"\n",
"The valid widget provides a read-only indicator."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.Valid(\n",
" value=False,\n",
" description='Valid!',\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Selection widgets"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"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`)."
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"### Dropdown"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.Dropdown(\n",
" options=['1', '2', '3'],\n",
" value='2',\n",
" description='Number:',\n",
" disabled=False,\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The following is also valid, displaying the words `'One', 'Two', 'Three'` as the dropdown choices but returning the values `1, 2, 3`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.Dropdown(\n",
" options=[('One', 1), ('Two', 2), ('Three', 3)],\n",
" value=2,\n",
" description='Number:',\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"### RadioButtons"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.RadioButtons(\n",
" options=['pepperoni', 'pineapple', 'anchovies'],\n",
"# value='pineapple',\n",
" description='Pizza topping:',\n",
" disabled=False\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"### Select"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.Select(\n",
" options=['Linux', 'Windows', 'OSX'],\n",
" value='OSX',\n",
" # rows=10,\n",
" description='OS:',\n",
" disabled=False\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### SelectionSlider"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.SelectionSlider(\n",
" options=['scrambled', 'sunny side up', 'poached', 'over easy'],\n",
" value='sunny side up',\n",
" description='I like my eggs ...',\n",
" disabled=False,\n",
" continuous_update=False,\n",
" orientation='horizontal',\n",
" readout=True\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### SelectionRangeSlider\n",
"\n",
"The value, index, and label keys are 2-tuples of the min and max values selected. The options must be nonempty."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import datetime\n",
"dates = [datetime.date(2015,i,1) for i in range(1,13)]\n",
"options = [(i.strftime('%b'), i) for i in dates]\n",
"widgets.SelectionRangeSlider(\n",
" options=options,\n",
" index=(0,11),\n",
" description='Months (2015)',\n",
" disabled=False\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"### ToggleButtons"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.ToggleButtons(\n",
" options=['Slow', 'Regular', 'Fast'],\n",
" description='Speed:',\n",
" disabled=False,\n",
" button_style='', # 'success', 'info', 'warning', 'danger' or ''\n",
" tooltips=['Description of slow', 'Description of regular', 'Description of fast'],\n",
"# icons=['check'] * 3\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### SelectMultiple\n",
"Multiple values can be selected with <kbd>shift</kbd> and/or <kbd>ctrl</kbd> (or <kbd>command</kbd>) pressed and mouse clicks or arrow keys."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.SelectMultiple(\n",
" options=['Apples', 'Oranges', 'Pears'],\n",
" value=['Oranges'],\n",
" #rows=10,\n",
" description='Fruits',\n",
" disabled=False\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## String widgets"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"There are several widgets that can be used to display a string value. The `Text`, `Textarea`, and `Combobox` 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."
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"### Text"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.Text(\n",
" value='Hello World',\n",
" placeholder='Type something',\n",
" description='String:',\n",
" disabled=False \n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Textarea"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.Textarea(\n",
" value='Hello World',\n",
" placeholder='Type something',\n",
" description='String:',\n",
" disabled=False\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Combobox"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.Combobox(\n",
" # value='John',\n",
" placeholder='Choose Someone',\n",
" options=['Paul', 'John', 'George', 'Ringo'],\n",
" description='Combobox:',\n",
" ensure_option=True,\n",
" disabled=False\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"### Label\n",
"\n",
"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."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.HBox([widgets.Label(value=\"The $m$ in $E=mc^2$:\"), widgets.FloatSlider()])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### HTML"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.HTML(\n",
" value=\"Hello <b>World</b>\",\n",
" placeholder='Some HTML',\n",
" description='Some HTML',\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### HTML Math"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.HTMLMath(\n",
" value=r\"Some math and <i>HTML</i>: \\(x^2\\) and $$\\frac{x+1}{x-1}$$\",\n",
" placeholder='Some HTML',\n",
" description='Some HTML',\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Button"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.Button(\n",
" description='Click me',\n",
" disabled=False,\n",
" button_style='', # 'success', 'info', 'warning', 'danger' or ''\n",
" tooltip='Click me',\n",
" icon='check'\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Output\n",
"\n",
"The `Output` widget can capture and display stdout, stderr and [rich output generated by IPython](http://ipython.readthedocs.io/en/stable/api/generated/IPython.display.html#module-IPython.display). For detailed documentation, see the [output widget examples](https://ipywidgets.readthedocs.io/en/latest/examples/Output Widget.html)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Play (Animation) widget"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"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."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"play = widgets.Play(\n",
"# interval=10,\n",
" value=50,\n",
" min=0,\n",
" max=100,\n",
" step=1,\n",
" description=\"Press play\",\n",
" disabled=False\n",
")\n",
"slider = widgets.IntSlider()\n",
"widgets.jslink((play, 'value'), (slider, 'value'))\n",
"widgets.HBox([play, slider])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Date picker\n",
"\n",
"The date picker widget works in Chrome, Firefox and IE Edge, but does not currently work in Safari because it does not support the HTML date input field."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.DatePicker(\n",
" description='Pick a Date',\n",
" disabled=False\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Color picker"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.ColorPicker(\n",
" concise=False,\n",
" description='Pick a color',\n",
" value='blue',\n",
" disabled=False\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## File Upload\n",
"\n",
"The `FileUpload` allows to upload any type of file(s) as bytes."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.FileUpload(\n",
" accept='', # Accepted file extension e.g. '.txt', '.pdf', 'image/*', 'image/*,.pdf'\n",
" multiple=False # True to accept multiple files upload else False\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Controller\n",
"\n",
"The `Controller` allows a game controller to be used as an input device."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"widgets.Controller(\n",
" index=0,\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Container/Layout widgets\n",
"\n",
"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."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Box"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"items = [widgets.Label(str(i)) for i in range(4)]\n",
"widgets.Box(items)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### HBox"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"items = [widgets.Label(str(i)) for i in range(4)]\n",
"widgets.HBox(items)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### VBox"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"items = [widgets.Label(str(i)) for i in range(4)]\n",
"left_box = widgets.VBox([items[0], items[1]])\n",
"right_box = widgets.VBox([items[2], items[3]])\n",
"widgets.HBox([left_box, right_box])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### GridBox\n",
"\n",
"This box uses the HTML Grid specification to lay out its children in two dimensional grid. The example below lays out the 8 items inside in 3 columns and as many rows as needed to accommodate the items."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"items = [widgets.Label(str(i)) for i in range(8)]\n",
"widgets.GridBox(items, layout=widgets.Layout(grid_template_columns=\"repeat(3, 100px)\"))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Accordion"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"accordion = widgets.Accordion(children=[widgets.IntSlider(), widgets.Text()])\n",
"accordion.set_title(0, 'Slider')\n",
"accordion.set_title(1, 'Text')\n",
"accordion"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Tabs\n",
"\n",
"In this example the children are set after the tab is created. Titles for the tabs are set in the same way they are for `Accordion`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"tab_contents = ['P0', 'P1', 'P2', 'P3', 'P4']\n",
"children = [widgets.Text(description=name) for name in tab_contents]\n",
"tab = widgets.Tab()\n",
"tab.children = children\n",
"for i in range(len(children)):\n",
" tab.set_title(i, str(i))\n",
"tab"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Accordion and Tab use `selected_index`, not value\n",
"\n",
"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`.\n",
"\n",
"Setting `selected_index = None` closes all of the accordions or deselects all tabs."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In the cells below try displaying or setting the `selected_index` of the `tab` and/or `accordion`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"tab.selected_index = 3"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"accordion.selected_index = None"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Nesting tabs and accordions\n",
"\n",
"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. \n",
"\n",
"The example below makes a couple of tabs with an accordion children in one of them"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"tab_nest = widgets.Tab()\n",
"tab_nest.children = [accordion, accordion]\n",
"tab_nest.set_title(0, 'An accordion')\n",
"tab_nest.set_title(1, 'Copy of the accordion')\n",
"tab_nest"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.8"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment