|
48 | 48 | "+ [Using `interact` to generate a widget interface to function](#interact:-a-shortcut-for-examining-functions)\n",
|
49 | 49 | "+ [The big picture: a preview of what widgets can do](#The-Big-Picture)\n",
|
50 | 50 | "+ [More about `interact`](#More-about-interact)\n",
|
51 |
| - "+ [Linking two similar widgets](#Linking-two-similar-widgets)\n", |
52 | 51 | "+ [The widget properties you can `link` and `observe`](#Keys:-the-widget-properties-you-can-observe-and-link)\n",
|
53 | 52 | "+ [`observe` changes in widget value](#observe-changes-in-a-widget-value)\n",
|
54 | 53 | "+ [Widgets in the core `ipywidgets` package](#Widgets-in-the-core-ipywidgets-package)"
|
|
819 | 818 | "For more extended examples of `interact` and `interactive`, see [the example in the ipywidgets source repository](https://github.com/jupyter-widgets/ipywidgets/blob/master/docs/source/examples/Index.ipynb)."
|
820 | 819 | ]
|
821 | 820 | },
|
822 |
| - { |
823 |
| - "cell_type": "markdown", |
824 |
| - "metadata": {}, |
825 |
| - "source": [ |
826 |
| - "## Linking two similar widgets" |
827 |
| - ] |
828 |
| - }, |
829 |
| - { |
830 |
| - "cell_type": "markdown", |
831 |
| - "metadata": { |
832 |
| - "slideshow": { |
833 |
| - "slide_type": "slide" |
834 |
| - } |
835 |
| - }, |
836 |
| - "source": [ |
837 |
| - "If you need to display the same value two different ways, you'll have to use two different widgets. Instead of attempting to manually synchronize the values of the two widgets, you can use the `link` or `jslink` function to link two properties together (the difference between these is discussed in [Widget Events](08.00-Widget_Events.ipynb)). Below, the values of two widgets are linked together." |
838 |
| - ] |
839 |
| - }, |
840 |
| - { |
841 |
| - "cell_type": "code", |
842 |
| - "execution_count": null, |
843 |
| - "metadata": {}, |
844 |
| - "outputs": [], |
845 |
| - "source": [ |
846 |
| - "a = widgets.FloatText()\n", |
847 |
| - "b = widgets.FloatSlider()\n", |
848 |
| - "display(a,b)\n", |
849 |
| - "\n", |
850 |
| - "mylink = widgets.link((a, 'value'), (b, 'value'))" |
851 |
| - ] |
852 |
| - }, |
853 |
| - { |
854 |
| - "cell_type": "markdown", |
855 |
| - "metadata": {}, |
856 |
| - "source": [ |
857 |
| - "### Unlinking widgets" |
858 |
| - ] |
859 |
| - }, |
860 |
| - { |
861 |
| - "cell_type": "markdown", |
862 |
| - "metadata": { |
863 |
| - "slideshow": { |
864 |
| - "slide_type": "slide" |
865 |
| - } |
866 |
| - }, |
867 |
| - "source": [ |
868 |
| - "Unlinking the widgets is simple. All you have to do is call `.unlink` on the link object. Try changing one of the widgets above after unlinking to see that they can be independently changed." |
869 |
| - ] |
870 |
| - }, |
871 |
| - { |
872 |
| - "cell_type": "code", |
873 |
| - "execution_count": null, |
874 |
| - "metadata": {}, |
875 |
| - "outputs": [], |
876 |
| - "source": [ |
877 |
| - "# mylink.unlink()" |
878 |
| - ] |
879 |
| - }, |
880 | 821 | {
|
881 | 822 | "cell_type": "markdown",
|
882 | 823 | "metadata": {
|
|
0 commit comments