From c0fb0d7cfa7d88a22b0ec80cfc23378e129e9519 2014-05-08 18:12:02 From: Jessica B. Hamrick Date: 2014-05-08 18:12:02 Subject: [PATCH] Only set widget description in interact if it does not already exist --- diff --git a/IPython/html/widgets/interaction.py b/IPython/html/widgets/interaction.py index b277551..1b59de8 100644 --- a/IPython/html/widgets/interaction.py +++ b/IPython/html/widgets/interaction.py @@ -166,7 +166,8 @@ def _widgets_from_abbreviations(seq): result = [] for name, abbrev, default in seq: widget = _widget_from_abbrev(abbrev, default) - widget.description = name + if not widget.description: + widget.description = name result.append(widget) return result diff --git a/examples/Interactive Widgets/Using Interact.ipynb b/examples/Interactive Widgets/Using Interact.ipynb index e63b8a7..7190534 100644 --- a/examples/Interactive Widgets/Using Interact.ipynb +++ b/examples/Interactive Widgets/Using Interact.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:d75ab1c53fa3389eeac78ecf8e89beb52871950f296aad25776699b6d6125037" + "signature": "sha256:3f30c6e839ac39f890da34a2af6bf50bf0d99ea32f7aadc043f3e31f619e4bc9" }, "nbformat": 3, "nbformat_minor": 0, @@ -87,7 +87,7 @@ "metadata": {}, "output_type": "display_data", "text": [ - "" + "" ] } ], @@ -110,7 +110,7 @@ " z=True,\n", " Text=u'Type here!',\n", " #Algorithm=['This','That','Other'],\n", - " a=widgets.FloatSliderWidget(min=-10.0, max=10.0, step=0.1, value=5.0)\n", + " a=widgets.FloatSliderWidget(min=-10.0, max=10.0, step=0.1, value=5.0, description=\"Float (a)\")\n", " )" ], "language": "python", @@ -122,14 +122,14 @@ "Current4.99\n", "TextType here!\n", "zTrue\n", - "a5.0\n", "Temp5\n", + "Float (a)5.0\n", "" ], "metadata": {}, "output_type": "display_data", "text": [ - "" + "" ] } ], @@ -150,14 +150,14 @@ "Current4.99\n", "TextType here!\n", "zTrue\n", - "a5.0\n", "Temp5\n", + "Float (a)5.0\n", "" ], "metadata": {}, "output_type": "display_data", "text": [ - "" + "" ] } ],