update,
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# So easy, *voilà*!\n",
|
||||
"\n",
|
||||
"In this example notebook, we demonstrate how Voilà can render notebooks making use of ipywidget's `@interact`."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "954b4c8acda94613bc8dde7e41ad5f9e",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
"text/plain": [
|
||||
"HBox(children=(VBox(children=(IntSlider(value=0), IntSlider(value=0))), Output()))"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from ipywidgets import HBox, VBox, IntSlider, interactive_output\n",
|
||||
"from IPython.display import display\n",
|
||||
"\n",
|
||||
"a = IntSlider()\n",
|
||||
"b = IntSlider()\n",
|
||||
"\n",
|
||||
"def f(a, b):\n",
|
||||
" print(\"{} * {} = {}\".format(a, b, a * b))\n",
|
||||
"\n",
|
||||
"out = interactive_output(f, { \"a\": a, \"b\": b })\n",
|
||||
"\n",
|
||||
"display(HBox([VBox([a, b]), out]))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"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.10.8"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
Reference in New Issue
Block a user