Created
July 8, 2021 09:14
-
-
Save RadoslawB/5c00e2d65e74d4878a72d70459a4c551 to your computer and use it in GitHub Desktop.
nb_widgets_viewer_render_test
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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"id": "nominated-kidney", | |
"metadata": { | |
"ExecuteTime": { | |
"end_time": "2021-07-08T08:59:12.838149Z", | |
"start_time": "2021-07-08T08:59:12.789863Z" | |
} | |
}, | |
"outputs": [], | |
"source": [ | |
"from ipywidgets import interact, interactive, fixed, interact_manual" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"id": "facial-richards", | |
"metadata": { | |
"ExecuteTime": { | |
"end_time": "2021-07-08T09:01:03.997546Z", | |
"start_time": "2021-07-08T09:01:03.993931Z" | |
} | |
}, | |
"outputs": [], | |
"source": [ | |
"def f(x):\n", | |
" print('::', x)\n", | |
" return x" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 11, | |
"id": "collaborative-riding", | |
"metadata": { | |
"ExecuteTime": { | |
"end_time": "2021-07-08T09:01:05.214499Z", | |
"start_time": "2021-07-08T09:01:05.182981Z" | |
} | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"application/vnd.jupyter.widget-view+json": { | |
"model_id": "66d72f2e14fd4322b628d264c279d286", | |
"version_major": 2, | |
"version_minor": 0 | |
}, | |
"text/plain": [ | |
"interactive(children=(Checkbox(value=True, description='x'), Output()), _dom_classes=('widget-interact',))" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"f_interact = interact(f, x=True)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"id": "capital-malpractice", | |
"metadata": { | |
"ExecuteTime": { | |
"end_time": "2021-07-08T08:59:39.378961Z", | |
"start_time": "2021-07-08T08:59:39.373120Z" | |
} | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"<function __main__.f(x)>" | |
] | |
}, | |
"execution_count": 5, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"f_interact" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"id": "tropical-strike", | |
"metadata": { | |
"ExecuteTime": { | |
"end_time": "2021-07-08T09:00:52.515363Z", | |
"start_time": "2021-07-08T09:00:52.511566Z" | |
} | |
}, | |
"outputs": [], | |
"source": [ | |
"from ipywidgets import widgets" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"id": "acceptable-container", | |
"metadata": { | |
"ExecuteTime": { | |
"end_time": "2021-07-08T09:00:52.989481Z", | |
"start_time": "2021-07-08T09:00:52.958224Z" | |
} | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"application/vnd.jupyter.widget-view+json": { | |
"model_id": "3d90df502c3348d689e1aeffd9a2b504", | |
"version_major": 2, | |
"version_minor": 0 | |
}, | |
"text/plain": [ | |
"interactive(children=(IntSlider(value=10, description='x', max=30, min=-10), Output()), _dom_classes=('widget-…" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"interact(f, x=widgets.IntSlider(min=-10, max=30, step=1, value=10));" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 12, | |
"id": "delayed-envelope", | |
"metadata": { | |
"ExecuteTime": { | |
"end_time": "2021-07-08T09:02:13.248521Z", | |
"start_time": "2021-07-08T09:02:13.222915Z" | |
} | |
}, | |
"outputs": [], | |
"source": [ | |
"from ipywidgets import IntSlider\n", | |
"from ipywidgets.embed import embed_minimal_html\n", | |
"\n", | |
"slider = IntSlider(value=40)\n", | |
"\n", | |
"slider\n", | |
"embed_minimal_html('export.html', views=[slider], title='Widgets export')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 16, | |
"id": "solved-spotlight", | |
"metadata": { | |
"ExecuteTime": { | |
"end_time": "2021-07-08T09:13:01.319680Z", | |
"start_time": "2021-07-08T09:13:01.270052Z" | |
} | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"application/vnd.jupyter.widget-view+json": { | |
"model_id": "a69d441ba41345599922d25f708fb15a", | |
"version_major": 2, | |
"version_minor": 0 | |
}, | |
"text/plain": [ | |
"interactive(children=(IntSlider(value=10, description='x', max=30, min=-10), Output()), _dom_classes=('widget-…" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"from ipywidgets.embed import embed_minimal_html, dependency_state\n", | |
"\n", | |
"s1 = IntSlider(max=200, value=100)\n", | |
"s2 = IntSlider(value=40)\n", | |
"f2 = interact(f, x=widgets.IntSlider(min=-10, max=30, step=1, value=10));\n", | |
"embed_minimal_html('export.html', views=[s1, s2], state=dependency_state([s1, s2]))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "micro-shoulder", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"hide_input": false, | |
"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.8.2" | |
}, | |
"toc": { | |
"base_numbering": 1, | |
"nav_menu": {}, | |
"number_sections": true, | |
"sideBar": true, | |
"skip_h1_title": false, | |
"title_cell": "Table of Contents", | |
"title_sidebar": "Contents", | |
"toc_cell": false, | |
"toc_position": {}, | |
"toc_section_display": true, | |
"toc_window_display": false | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment