Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix example code in basics.ipynb #982

Merged
merged 1 commit into from
Sep 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions notebooks/basics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,64 +2,66 @@
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# So easy, *voilà*!\n",
"\n",
"In this example notebook, we demonstrate how Voilà can render Jupyter notebooks with interactions requiring a roundtrip to the kernel."
]
],
"metadata": {}
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Jupyter Widgets"
]
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import ipywidgets as widgets\n",
"\n",
"slider = widgets.FloatSlider(description='$x$', value=4)\n",
"slider = widgets.FloatSlider(description='$x$')\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",
"slider.value = 4\n",
"\n",
"widgets.VBox([slider, text])"
]
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Basic outputs of code cells"
]
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"\n",
"iris = pd.read_csv('https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv')\n",
"iris"
]
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"source": [],
"outputs": [],
"source": []
"metadata": {}
}
],
"metadata": {
Expand All @@ -83,4 +85,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}