-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
graphic components for jupyter notebooks
- Loading branch information
1 parent
4f0d21d
commit faf178a
Showing
1 changed file
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "0c61c3d5-9758-4fab-9c01-1bc8ddb3cd9b", | ||
"metadata": {}, | ||
"source": [ | ||
"# Jupyter widgets\n", | ||
"Widgets are visual components that enhance the interaction with a Jupyter notebook." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "9f89e038-4e57-475c-957f-6cd7dde506df", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from IPython.display import display\n", | ||
"from ipywidgets import Checkbox, VBox, HBox, Layout, Text, Image\n", | ||
"from ipywidgets import interact, interactive, fixed, interact_manual\n", | ||
"import ipywidgets as widgets" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "38ea8cef-aa3b-44be-8d7e-96e5c856e786", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"a = widgets.Checkbox(description='a', layout=Layout(object_position='left'))\n", | ||
"b = widgets.Checkbox(description='b', object_position='left')\n", | ||
"c = widgets.Checkbox(description='c')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "c7b12ca6-4a26-4057-8ee6-0867481bc3f7", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def f(a, b, c):\n", | ||
" print('{}, {}, {}'.format(a, b, c))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"id": "3fe87ec6-4cc8-41c0-8bd6-f2a8eeee6f80", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"application/vnd.jupyter.widget-view+json": { | ||
"model_id": "7fb6ddb7f1fe4a1189823b9e9a624a27", | ||
"version_major": 2, | ||
"version_minor": 0 | ||
}, | ||
"text/plain": [ | ||
"HBox(children=(HBox(children=(Checkbox(value=False, description='a', layout=Layout(object_position='left')), C…" | ||
] | ||
}, | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"out = widgets.interactive_output(f, {'a': a, 'b': b, 'c': c})\n", | ||
"widgets.HBox([widgets.HBox([a, b, c]), out])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5a78227e-041d-436d-99ea-00076d0abc66", | ||
"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.11.5" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |