{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "< [Dashboarding with widgets](08.00-voila.ipynb) | [Contents](00.00-index.ipynb) | [Deploying voilà](08.02-voila-vuetify.ipynb) >" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# So easy, *voilà*!\n", "\n", "In this example notebook, we demonstrate how voila can render Jupyter notebooks with interactions requiring a roundtrip to the kernel." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Jupyter Widgets" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import ipywidgets as widgets\n", "\n", "slider = widgets.FloatSlider(description='x', value=4)\n", "text = widgets.FloatText(disabled=True, description='$x^2$')\n", "\n", "def compute(*ignore):\n", " text.value = str(slider.value ** 2)\n", "\n", "slider.observe(compute, 'value')\n", "\n", "widgets.VBox([slider, text])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Basic outputs of code cells" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "skip" ] }, "outputs": [], "source": [ "import pandas as pd\n", "\n", "iris = pd.read_csv('https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv')\n", "iris" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "< [Dashboarding with widgets](08.00-voila.ipynb) | [Contents](00.00-index.ipynb) | [Deploying voilà](08.02-voila-vuetify.ipynb) >" ] } ], "metadata": { "celltoolbar": "Tags", "kernelspec": { "display_name": "widgets-tutorial", "language": "python", "name": "widgets-tutorial" }, "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.8.3" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": {}, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 4 }