From 615ab9ac64c8dbb28a2e53632be130cd746655c1 2014-01-23 01:14:45 From: Jonathan Frederic Date: 2014-01-23 01:14:45 Subject: [PATCH] Updated widget tutorials 1-2 --- diff --git a/examples/widgets/Part 1 - Basics.ipynb b/examples/widgets/Part 1 - Basics.ipynb index 2fcf1e6..5be0775 100644 --- a/examples/widgets/Part 1 - Basics.ipynb +++ b/examples/widgets/Part 1 - Basics.ipynb @@ -17,7 +17,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To use IPython widgets in the notebook, the widget namespace and display function need to be imported." + "To use IPython widgets in the notebook, the widget namespace and optionally the display function need to be imported." ] }, { @@ -46,20 +46,33 @@ "source": [ "The IPython notebook comes preloaded with basic widgets that represent common data types. These widgets are\n", "\n", - "- BoolWidget : boolean \n", - "- FloatRangeWidget : bounded float \n", - "- FloatWidget : unbounded float \n", - "- ImageWidget : image\n", - "- IntRangeWidget : bounded integer \n", - "- IntWidget : unbounded integer \n", - "- SelectionWidget : enumeration \n", - "- StringWidget : string \n", + "- CheckBoxWidget\n", + "- ToggleButtonWidget\n", + "- FloatSliderWidget\n", + "- BoundedFloatTextWidget\n", + "- FloatProgressWidget\n", + "- FloatTextWidget\n", + "- ImageWidget\n", + "- IntSliderWidget\n", + "- BoundedIntTextWidget\n", + "- IntProgressWidget\n", + "- IntTextWidget\n", + "- ToggleButtonsWidget\n", + "- RadioButtonsWidget\n", + "- DropdownWidget\n", + "- ListBoxWidget\n", + "- HTMLWidget\n", + "- LatexWidget\n", + "- TextAreaWidget\n", + "- TextBoxWidget\n", "\n", "A few special widgets are also included, that can be used to capture events and change how other widgets are displayed. These widgets are\n", "\n", - "- ButtonWidget \n", - "- ContainerWidget \n", - "- MulticontainerWidget \n", + "- ButtonWidget\n", + "- ContainerWidget\n", + "- PopupWidget\n", + "- AccordionWidget\n", + "- TabWidget\n", "\n", "To see the complete list of widgets, one can execute the following" ] @@ -78,18 +91,31 @@ "output_type": "pyout", "prompt_number": 2, "text": [ - "['BoolWidget',\n", + "['AccordionWidget',\n", + " 'BoundedFloatTextWidget',\n", + " 'BoundedIntTextWidget',\n", " 'ButtonWidget',\n", + " 'CheckBoxWidget',\n", " 'ContainerWidget',\n", " 'DOMWidget',\n", - " 'FloatRangeWidget',\n", - " 'FloatWidget',\n", + " 'DropdownWidget',\n", + " 'FloatProgressWidget',\n", + " 'FloatSliderWidget',\n", + " 'FloatTextWidget',\n", + " 'HTMLWidget',\n", " 'ImageWidget',\n", - " 'IntRangeWidget',\n", - " 'IntWidget',\n", - " 'SelectionContainerWidget',\n", - " 'SelectionWidget',\n", - " 'StringWidget',\n", + " 'IntProgressWidget',\n", + " 'IntSliderWidget',\n", + " 'IntTextWidget',\n", + " 'LatexWidget',\n", + " 'ListBoxWidget',\n", + " 'PopupWidget',\n", + " 'RadioButtonsWidget',\n", + " 'TabWidget',\n", + " 'TextAreaWidget',\n", + " 'TextBoxWidget',\n", + " 'ToggleButtonWidget',\n", + " 'ToggleButtonsWidget',\n", " 'Widget']" ] } @@ -107,7 +133,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "mywidget = widgets.FloatRangeWidget()" + "mywidget = widgets.FloatSliderWidget()" ], "language": "python", "metadata": {}, @@ -118,7 +144,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Constructing a widget does not display it on the page. To display a widget, the widget must be passed to the IPython `display(object)` method. `mywidget` is displayed by" + "Constructing a widget does not display it on the page. To display a widget, the widget must be passed to the IPython `display(object)` method or must be returned as the last item in the cell. `mywidget` is displayed by" ] }, { @@ -133,24 +159,22 @@ "prompt_number": 4 }, { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "or" + ] + }, + { "cell_type": "code", "collapsed": false, "input": [ - "mywidget.value\n" + "mywidget" ], "language": "python", "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 10, - "text": [ - "50.6" - ] - } - ], - "prompt_number": 10 + "outputs": [], + "prompt_number": 5 }, { "cell_type": "markdown", @@ -158,7 +182,7 @@ "source": [ "It's important to realize that widgets are not the same as output, even though they are displayed with `display`. Widgets are drawn in a special widget area. That area is marked with a close button which allows you to collapse the widgets. Widgets cannot be interleaved with output. Doing so would break the ability to make simple animations using `clear_output`.\n", "\n", - "Widgets are manipulated via special instance properties (traitlets). The names of these instance properties are listed in the widget's `keys` property (as seen below). A few of these properties are common to most, if not all, widgets. The common properties are `value`, `description`, `visible`, and `disabled`. `_css`, `_add_class`, and `_remove_class` are internal properties that exist in all widgets and should not be modified." + "Widgets are manipulated via special instance properties (traitlets). The names of these instance properties are listed in the widget's `keys` property (as seen below). A few of these properties are common to most, if not all, widgets. The common properties are `value`, `description`, `visible`, and `disabled`. `_css` and `_view_name` are internal properties that exist in all widgets and should not be modified." ] }, { @@ -173,28 +197,28 @@ { "metadata": {}, "output_type": "pyout", - "prompt_number": 11, + "prompt_number": 6, "text": [ - "['value',\n", - " 'step',\n", - " 'max',\n", + "['_view_name',\n", + " 'description',\n", " 'min',\n", - " 'disabled',\n", " 'orientation',\n", - " 'description',\n", - " 'visible',\n", + " 'max',\n", " '_css',\n", - " 'view_name']" + " 'value',\n", + " 'disabled',\n", + " 'visible',\n", + " 'step']" ] } ], - "prompt_number": 11 + "prompt_number": 6 }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Changing a widget's property value will automatically update that widget everywhere it is displayed in the notebook. Here the value of `mywidget` is set. The slider shown above (after input 4) updates automatically to the new value. In reverse, changing the value of the displayed widget will update the property's value." + "Changing a widget's property value will automatically update that widget everywhere it is displayed in the notebook. Here the value of `mywidget` is set. The slider shown above (after inputs 4 and 5) updates automatically to the new value. In reverse, changing the value of the displayed widget will update the property's value." ] }, { @@ -206,7 +230,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 12 + "prompt_number": 7 }, { "cell_type": "markdown", @@ -227,13 +251,13 @@ { "metadata": {}, "output_type": "pyout", - "prompt_number": 13, + "prompt_number": 8, "text": [ - "25.0" + "0.0" ] } ], - "prompt_number": 13 + "prompt_number": 8 }, { "cell_type": "markdown", @@ -246,13 +270,13 @@ "cell_type": "code", "collapsed": false, "input": [ - "mysecondwidget = widgets.SelectionWidget(values=[\"Item A\", \"Item B\", \"Item C\"], value=\"Nothing Selected\")\n", + "mysecondwidget = widgets.RadioButtonsWidget(values=[\"Item A\", \"Item B\", \"Item C\"], value=\"Item A\")\n", "display(mysecondwidget)" ], "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 14 + "prompt_number": 9 }, { "cell_type": "code", @@ -266,101 +290,13 @@ { "metadata": {}, "output_type": "pyout", - "prompt_number": 15, - "text": [ - "u'Item B'" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Views" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "The data types that most of the widgets represent can be displayed more than one way. A `view` is a visual representation of a widget in the notebook. In the example in the section above, the default `view` for the `FloatRangeWidget` is used. The default view is set in the widgets `default_view_name` instance property (as seen below)." - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "mywidget.default_view_name" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 19, + "prompt_number": 10, "text": [ - "u'FloatSliderView'" + "'Item A'" ] } ], - "prompt_number": 19 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "When a widget is displayed using `display(...)`, the `default_view_name` is used to determine what view type should be used to display the widget. View names are case sensitive. Sometimes the default view isn't the best view to represent a piece of data. To change what view is used, either the `default_view_name` can be changed or the `view_name` kwarg of `display` can be set. This also can be used to display one widget multiple ways in one output (as seen below)." - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "display(mywidget)\n", - "display(mywidget, view_name=\"FloatTextView\")" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 20 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Some views work with multiple different widget types and some views only work with one. The complete list of views and supported widgets is below. The default views are italicized.\n", - "\n", - "| Widget Name | View Names |\n", - "|:-----------------------|:--------------------|\n", - "| BoolWidget | *CheckboxView* |\n", - "| | ToggleButtonView |\n", - "| ButtonWidget | *ButtonView* |\n", - "| ContainerWidget | *ContainerView* |\n", - "| | ModalView |\n", - "| FloatRangeWidget | *FloatSliderView* |\n", - "| | FloatTextView |\n", - "| | ProgressView |\n", - "| FloatWidget | *FloatTextView* |\n", - "| ImageWidget | *ImageView* |\n", - "| IntRangeWidget | *IntSliderView* |\n", - "| | IntTextView |\n", - "| | ProgressView |\n", - "| IntWidget | *IntTextView* |\n", - "| MulticontainerWidget | AccordionView |\n", - "| | *TabView* |\n", - "| SelectionWidget | ToggleButtonsView |\n", - "| | RadioButtonsView |\n", - "| | *DropdownView* |\n", - "| | ListBoxView |\n", - "| StringWidget | HTMLView |\n", - "| | LatexView |\n", - "| | TextAreaView |\n", - "| | *TextBoxView* |\n" - ] + "prompt_number": 10 } ], "metadata": {} diff --git a/examples/widgets/Part 2 - Events.ipynb b/examples/widgets/Part 2 - Events.ipynb index 83aa30c..3aa2fa3 100644 --- a/examples/widgets/Part 2 - Events.ipynb +++ b/examples/widgets/Part 2 - Events.ipynb @@ -102,7 +102,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "intrange = widgets.IntRangeWidget()\n", + "intrange = widgets.IntSliderWidget()\n", "display(intrange)\n", "\n", "def on_value_change(name, value):\n", @@ -117,223 +117,6 @@ "output_type": "stream", "stream": "stdout", "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "11\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "13\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "14\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "16\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "18\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "20\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "22\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "24\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "26\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "29\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "30\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "33\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "36\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "38\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "42\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "45\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "46\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "48\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "50\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "51\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "52\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "53\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "54\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "52\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "50\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "48\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "44\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "41\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ "34\n" ] }, @@ -341,35 +124,14 @@ "output_type": "stream", "stream": "stdout", "text": [ - "30\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "28\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "26\n" + "74\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ - "25\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "24\n" + "98\n" ] } ], @@ -411,8 +173,9 @@ "output_type": "stream", "stream": "stdout", "text": [ - "Register a callback to execute when the button is clicked. The\n", - " callback can either accept no parameters or one sender parameter:\n", + "Register a callback to execute when the button is clicked. \n", + "\n", + " The callback can either accept no parameters or one sender parameter:\n", " - callback()\n", " - callback(sender)\n", " If the callback has a sender parameter, the ButtonWidget instance that\n", @@ -438,123 +201,11 @@ "cell_type": "code", "collapsed": false, "input": [ - "display(intrange)\n", - "print('hi')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "hi\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "23\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "24\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "28\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "30\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "37\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "39\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "41\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "44\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "46\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "48\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "50\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "51\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "53\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ "button = widgets.ButtonWidget(description=\"Click Me!\")\n", "display(button)\n", "\n", "def on_button_clicked(sender):\n", " print(\"Button clicked.\")\n", - " intrange.value +=1\n", "\n", "button.on_click(on_button_clicked)" ], @@ -565,28 +216,25 @@ "output_type": "stream", "stream": "stdout", "text": [ - "Button clicked.\n", - "54\n" + "Button clicked.\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ - "Button clicked.\n", - "55\n" + "Button clicked.\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ - "Button clicked.\n", - "56\n" + "Button clicked.\n" ] } ], - "prompt_number": 6 + "prompt_number": 5 }, { "cell_type": "markdown", @@ -598,62 +246,24 @@ { "cell_type": "code", "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 11, - "text": [ - "{'content': {'data': \"{'parent_header': {}, 'msg_type': u'comm_msg', 'msg_id': u'3DBB06AD83C942DD85DC6477B08F1FBF', 'content': {u'data': {u'method': u'custom', u'custom_content': {u'event': u'click'}}, u'comm_id': u'eea5f11ae7aa473993dd0c81d6016648'}, 'header': {u'username': u'username', u'msg_id': u'3DBB06AD83C942DD85DC6477B08F1FBF', u'msg_type': u'comm_msg', u'session': u'0F6D6BE728DA47A38CFC4BDEACF34FC4'}, 'buffers': [], 'metadata': {}}\\ncustom message {'parent_header': {}, 'msg_type': u'comm_msg', 'msg_id': u'3DBB06AD83C942DD85DC6477B08F1FBF', 'content': {u'data': {u'method': u'custom', u'custom_content': {u'event': u'click'}}, u'comm_id': u'eea5f11ae7aa473993dd0c81d6016648'}, 'header': {u'username': u'username', u'msg_id': u'3DBB06AD83C942DD85DC6477B08F1FBF', u'msg_type': u'comm_msg', u'session': u'0F6D6BE728DA47A38CFC4BDEACF34FC4'}, 'buffers': [], 'metadata': {}}\\nhandling click\\n{u'event': u'click'}\\nButton clicked.\\n2\\n\",\n", - " 'name': 'stdout'},\n", - " 'header': {'msg_id': 'd9dc144a-d86c-42c1-8bab-f8a6bc525723',\n", - " 'msg_type': 'stream',\n", - " 'session': '9b9408d8-7420-4e0c-976d-cdda9f8d2564',\n", - " 'username': 'kernel'},\n", - " 'metadata': {},\n", - " 'msg_id': 'd9dc144a-d86c-42c1-8bab-f8a6bc525723',\n", - " 'msg_type': 'stream',\n", - " 'parent_header': {'msg_id': '3DBB06AD83C942DD85DC6477B08F1FBF',\n", - " 'msg_type': 'comm_msg',\n", - " 'session': '0F6D6BE728DA47A38CFC4BDEACF34FC4',\n", - " 'username': 'username'}}" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "code", - "collapsed": false, "input": [ - "def show_button(sender=None):\n", + "def show_button(sender):\n", " button = widgets.ButtonWidget()\n", " button.clicks = 0\n", - " if sender is None:\n", - " button.description = \"0\"\n", - " else:\n", - " sender.clicks += 1\n", - " button.description = \"%d\" % sender.clicks\n", + " sender.clicks += 1\n", + " button.description = \"%d\" % sender.clicks\n", " display(button)\n", " button.on_click(show_button)\n", - "show_button()\n", + "button = widgets.ButtonWidget(description = \"Start\")\n", + "button.clicks = 0\n", + "display(button)\n", + "button.on_click(show_button)\n", " " ], "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 7 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] + "prompt_number": 6 } ], "metadata": {} diff --git a/examples/widgets/Part 3 - Placement.ipynb b/examples/widgets/Part 3 - Placement.ipynb index 0293314..4a35da4 100644 --- a/examples/widgets/Part 3 - Placement.ipynb +++ b/examples/widgets/Part 3 - Placement.ipynb @@ -17,9 +17,6 @@ "cell_type": "code", "collapsed": false, "input": [ - "\n", - "\n", - "\n", "from IPython.html import widgets # Widget definitions\n", "from IPython.display import display # Used to display widgets in the notebook" ], @@ -40,27 +37,37 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To display widget A inside widget B, widget A must be a child of widget B. With IPython widgets, the widgets are instances that live in the back-end (usally Python). There can be multiple views displayed in the front-end that represent one widget in the backend. Each view can be displayed at a different time, or even displayed two or more times in the same output. Because of this, the parent of a widget can only be set before the widget has been displayed.\n", + "To display widget A inside widget B, widget A must be a child of widget B. With IPython widgets, the widgets are instances that live in the back-end (usally Python). There can be multiple views displayed in the front-end that represent one widget in the backend. Each view can be displayed at a different time. Only one instance of any particular model can be child of another. In other words, *widget A* cannot have *widget B* listed twice in it's children list.\n", "\n", - "Every widget has a `parent` property. This property can be set via a kwarg in the widget's constructor or after construction, but before display. Calling display on an object with children automatically displays those children too (as seen below)." + "Widgets that can contain other widgets have a `children` property. This property can be set via a kwarg in the widget's constructor or after construction. Calling display on an object with children automatically displays those children too (as seen below)." ] }, { "cell_type": "code", "collapsed": false, "input": [ + "floatrange = widgets.FloatSliderWidget() # You can set the parent in the constructor,\n", "\n", - "floatrange = widgets.FloatRangeWidget() # You can set the parent in the constructor,\n", - "\n", - "string = widgets.StringWidget(value='hi')\n", + "string = widgets.TextBocWidget(value='hi')\n", "container = widgets.ContainerWidget(children=[floatrange, string])\n", "\n", "display(container) # Displays the `container` and all of it's children." ], "language": "python", "metadata": {}, - "outputs": [], - "prompt_number": 2 + "outputs": [ + { + "ename": "AttributeError", + "evalue": "'module' object has no attribute 'TextBocWidget'", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mAttributeError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[0mfloatrange\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mwidgets\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mFloatSliderWidget\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;31m# You can set the parent in the constructor,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[0mstring\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mwidgets\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mTextBocWidget\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mvalue\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m'hi'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 4\u001b[0m \u001b[0mcontainer\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mwidgets\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mContainerWidget\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mchildren\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mfloatrange\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mstring\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mAttributeError\u001b[0m: 'module' object has no attribute 'TextBocWidget'" + ] + } + ], + "prompt_number": 4 }, { "cell_type": "markdown",