Add support for ipywidgets#10606
Merged
DonJayamanne merged 6 commits intomicrosoft:ds/ipyWidgetsfrom Mar 17, 2020
Merged
Conversation
|
Kudos, SonarCloud Quality Gate passed!
|
|
Woot! Sounds good to me. Awesome that it works |
Author
Not sure you noticed. I generally use |
This was referenced Mar 23, 2020
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@rchiodo Here's a demo of it working
iopub not defined in undefined- obviously due to the changes in master since the last prototype).Here's the ipynb:
{ "nbformat": 4, "nbformat_minor": 2, "metadata": { "language_info": { "name": "python", "codemirror_mode": { "name": "ipython", "version": 3 }, "version": "3.7.6-final" }, "orig_nbformat": 2, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "npconvert_exporter": "python", "pygments_lexer": "ipython3", "version": 3, "kernelspec": { "name": "python3", "display_name": "Python 3" } }, "cells": [ { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "import ipywidgets as widgets" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "output_type": "display_data", "data": { "text/plain": "IntSlider(value=0)", "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "212bb05a08524cf6ae6b53dac1b54744" } }, "metadata": {} } ], "source": [ "widgets.IntSlider()" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "output_type": "display_data", "data": { "text/plain": "Text(value='Hello World!', disabled=True)", "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "49f082208f3b475f9cf176cecec653bc" } }, "metadata": {} } ], "source": [ "widgets.Text(value='Hello World!', disabled=True)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "output_type": "display_data", "data": { "text/plain": "VBox(children=(IntSlider(value=0, continuous_update=False, description='Delayed'), IntText(value=0, descriptio…", "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "bb43fbac077f413fac1f982254a61972" } }, "metadata": {} } ], "source": [ "\n", "a = widgets.IntSlider(description=\"Delayed\", continuous_update=False)\n", "b = widgets.IntText(description=\"Delayed\", continuous_update=False)\n", "c = widgets.IntSlider(description=\"Continuous\", continuous_update=True)\n", "d = widgets.IntText(description=\"Continuous\", continuous_update=True)\n", "\n", "widgets.link((a, 'value'), (b, 'value'))\n", "widgets.link((a, 'value'), (c, 'value'))\n", "widgets.link((a, 'value'), (d, 'value'))\n", "widgets.VBox([a,b,c,d])" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "output_type": "display_data", "data": { "text/plain": "Label(value='The values of range1 and range2 are synchronized')", "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "9c926f7815c04f1ab52ebe6d01a22b2f" } }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": "IntSlider(value=1, description='Slider', max=5, min=-5)", "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "0d598d0771024720acfe39cce9653320" } }, "metadata": {} } ], "source": [ "caption = widgets.Label(value='The values of range1 and range2 are synchronized')\n", "slider = widgets.IntSlider(min=-5, max=5, value=1, description='Slider')\n", "\n", "def handle_slider_change(change):\n", " caption.value = 'The slider value is ' + (\n", " 'negative' if change.new < 0 else 'nonnegative'\n", " )\n", "\n", "slider.observe(handle_slider_change, names='value')\n", "\n", "display(caption, slider)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ] }