From 796c0edbeff2254b74bbd1021ef12e8b200a21a1 2014-01-23 21:06:18 From: Jonathan Frederic Date: 2014-01-23 21:06:18 Subject: [PATCH] Cleanup examples - Fixed output numbering. - Multiple typo fixes. - Added index notebook. - Added easy navigation to tutorials (next and back links). --- diff --git a/examples/widgets/Part 1 - Basics.ipynb b/examples/widgets/Part 1 - Basics.ipynb index 5be0775..e72c0d5 100644 --- a/examples/widgets/Part 1 - Basics.ipynb +++ b/examples/widgets/Part 1 - Basics.ipynb @@ -17,7 +17,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To use IPython widgets in the notebook, the widget namespace and optionally the display function need to be imported." + "[Index](index.ipynb)\n", + "\n", + "To use IPython widgets in the notebook, the widget namespace needs to be imported." ] }, { @@ -126,7 +128,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The basic widgets can all be constructed without arguments. The following creates a FloatRangeWidget without displaying it" + "The basic widgets can all be constructed without arguments. The following creates a *FloatSliderWidget* without displaying it" ] }, { @@ -297,6 +299,13 @@ } ], "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In [Part 2](Part 2 - Events.ipynb) of this [series](index.ipynb), you will learn about widget events." + ] } ], "metadata": {} diff --git a/examples/widgets/Part 2 - Events.ipynb b/examples/widgets/Part 2 - Events.ipynb index 3aa2fa3..8ab8343 100644 --- a/examples/widgets/Part 2 - Events.ipynb +++ b/examples/widgets/Part 2 - Events.ipynb @@ -14,6 +14,13 @@ { "cells": [ { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[< Back to Part 1](Part 1 - Basics.ipynb) or [Index](index.ipynb)" + ] + }, + { "cell_type": "code", "collapsed": false, "input": [ @@ -39,7 +46,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The widget properties are IPython traitlets. Traitlets are eventful. To handle property value changes, the `on_trait_change` method of the widget can be used to register an event handling callback. The doc string for `on_trait_change` can be seen below. Both the `name` and `remove` properties are optional." + "As mentioned in Part 1, the widget properties are IPython traitlets. Traitlets are eventful. To handle property value changes, the `on_trait_change` method of the widget can be used to register an event handling callback. The doc string for `on_trait_change` can be seen below. Both the `name` and `remove` properties are optional." ] }, { @@ -95,7 +102,7 @@ "- callback(trait_name, new_value)\n", "- callback(trait_name, old_value, new_value)\n", "\n", - "An example of how to output an IntRangeWiget's value as it is changed can be seen below." + "Using this method, an example of how to output an IntSliderWiget's value as it is changed can be seen below." ] }, { @@ -157,7 +164,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The `ButtonWidget` is a special widget, like the `ContainerWidget` and `MulticontainerWidget`, that isn't used to represent a data type. Instead the button widget is used to handle mouse clicks. The `on_click` method of the `ButtonWidget` can be used to register a click even handler. The doc string of the `on_click` can be seen below." + "The `ButtonWidget` is a special widget, like the `ContainerWidget` and `TabWidget`, that isn't used to represent a data type. Instead the button widget is used to handle mouse clicks. The `on_click` method of the `ButtonWidget` can be used to register a click even handler. The doc string of the `on_click` can be seen below." ] }, { @@ -264,6 +271,13 @@ "metadata": {}, "outputs": [], "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In [Part 3](Part 3 - Placement.ipynb) of this [series](index.ipynb), you will learn about widget placement." + ] } ], "metadata": {} diff --git a/examples/widgets/Part 3 - Placement.ipynb b/examples/widgets/Part 3 - Placement.ipynb index ed97cc5..7630ad3 100644 --- a/examples/widgets/Part 3 - Placement.ipynb +++ b/examples/widgets/Part 3 - Placement.ipynb @@ -14,6 +14,13 @@ { "cells": [ { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[< Back to Part 2](Part 2 - Events.ipynb) or [Index](index.ipynb)" + ] + }, + { "cell_type": "code", "collapsed": false, "input": [ @@ -37,7 +44,7 @@ "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. 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", + "To display widget A inside widget B, widget A must be a child of widget B. 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", "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)." ] @@ -164,6 +171,13 @@ "metadata": {}, "outputs": [], "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In [Part 4](Part 4 - Styles.ipynb) of this [series](index.ipynb), you will learn about widget styling." + ] } ], "metadata": {} diff --git a/examples/widgets/Part 4 - Styles.ipynb b/examples/widgets/Part 4 - Styles.ipynb index a31e7e7..6bb04e1 100644 --- a/examples/widgets/Part 4 - Styles.ipynb +++ b/examples/widgets/Part 4 - Styles.ipynb @@ -14,6 +14,13 @@ { "cells": [ { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[< Back to Part 3](Part 3 - Placement.ipynb) or [Index](index.ipynb)" + ] + }, + { "cell_type": "code", "collapsed": false, "input": [ @@ -37,7 +44,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "When trying to design an attractive widget GUI, styling becomes important. Widget views are DOM (document object model) elements that can be controlled with CSS. There are two helper methods defined on widget that allow the manipulation of the widget's CSS. The first is the `set_css` method, whos doc string is displayed below. This method allows one or more CSS attributes to be set at once. " + "When trying to design an attractive widget GUI, styling becomes important. Most Widgets views are DOM (document object model) elements that can be controlled with CSS. There are two helper methods defined on widget that allow the manipulation of the widget's CSS. The first is the `set_css` method, whos doc string is displayed below. This method allows one or more CSS attributes to be set at once. " ] }, { @@ -193,7 +200,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Since `add_class` if a DOM operation, it will only affect widgets that have been displayed. `add_class` must be called after the widget has been displayed. Extending the example above, the corners of the container can be rounded by adding the `corner-all` notebook class to the container (as seen below). " + "Since `add_class` if a DOM operation, **it will only affect widgets that have already been displayed**. `add_class` must be called after the widget has been displayed. Extending the example above, the corners of the container can be rounded by adding the `corner-all` notebook class to the container (as seen below). " ] }, { @@ -272,7 +279,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "It's also useful to be able to remove DOM classes from widgets. The `remove_class` widget method allows you to remove classes from widgets that have been displayed. Like `add_widget`, it must be called after the widget has been displayed. The doc string of `remove_class` can be seen below." + "It's also useful to be able to remove DOM classes from widgets. The `remove_class` widget method allows you to remove classes from widgets that have been displayed. Like `add_class`, it must be called after the widget has been displayed. The doc string of `remove_class` can be seen below." ] }, { @@ -333,6 +340,13 @@ "metadata": {}, "outputs": [], "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In [Part 5](Part 5 - Alignment.ipynb) of this [series](index.ipynb), you will learn about widget alignment." + ] } ], "metadata": {} diff --git a/examples/widgets/Part 5 - Alignment.ipynb b/examples/widgets/Part 5 - Alignment.ipynb index 701f8a9..ce91949 100644 --- a/examples/widgets/Part 5 - Alignment.ipynb +++ b/examples/widgets/Part 5 - Alignment.ipynb @@ -14,6 +14,13 @@ { "cells": [ { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[< Back to Part 4](Part 4 - Styles.ipynb) or [Index](index.ipynb)" + ] + }, + { "cell_type": "code", "collapsed": false, "input": [ @@ -107,7 +114,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "`ContainerWidget`s allow for custom alignment of widgets. The `hbox` and `vbox` methods (parameterless) cause the `ContainerWidget` to both horizontally and vertically align its children. The following example compares `vbox` to `hbox`." + "`ContainerWidget`s allow for custom alignment of widgets. The `hbox` and `vbox` DOM classes cause the `ContainerWidget` to both horizontally and vertically align its children. The following example compares `vbox` to `hbox`." ] }, { @@ -160,7 +167,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The `ContainerWidget` `pack_start`, `pack_center`, and `pack_end` methods (parameterless) adjust the alignment of the widgets on the axis that they are being rendered on. Below is an example of the different alignments." + "The `start`, `center`, and `end` DOM classes adjust the alignment of the widgets on the axis that they are being rendered on. Below is an example of the different alignments." ] }, { @@ -191,7 +198,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The `ContainerWidget` `flex0`, `flex1`, and `flex2` methods (parameterless) modify the containers flexibility. Changing a container flexibility affects how and if the container will occupy the remaining space. Setting `flex0` has the same result as setting no flex. Below is an example of different flex configurations. The number on the boxes correspond to the applied flex." + "The `box-flex0`, `box-flex1`, and `box-flex2` DOM classes modify the container's flexibility. Changing a container flexibility affects how and if the container will occupy the remaining space. Applying `box-flex0` has the same result as not applying flex. Below is an example of different flex configurations. The number on the boxes correspond to the applied flex." ] }, { @@ -249,7 +256,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The `ContainerWidget` `align_start`, `align_center`, and `align_end` methods (parameterless) adjust the alignment of the widgets on the axis perpindicular to the one that they are being rendered on. Below is an example of the different alignments." + "The `align_start`, `align_center`, and `align_end` DOM classes adjust the alignment of the widgets on the axis perpindicular to the one that they are being rendered on. Below is an example of the different alignments." ] }, { @@ -305,6 +312,13 @@ "metadata": {}, "outputs": [], "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In [Part 6](Part 6 - Custom Widget.ipynb) of this [series](index.ipynb), you will learn how to create your own custom widget." + ] } ], "metadata": {} diff --git a/examples/widgets/Part 6 - Custom Widget.ipynb b/examples/widgets/Part 6 - Custom Widget.ipynb index d9073a3..05fabd5 100644 --- a/examples/widgets/Part 6 - Custom Widget.ipynb +++ b/examples/widgets/Part 6 - Custom Widget.ipynb @@ -17,6 +17,8 @@ "cell_type": "markdown", "metadata": {}, "source": [ + "[< Back to Part 5](Part 5 - Alignment.ipynb) or [Index](index.ipynb)\n", + "\n", "Before reading, the author recommends the reader to review\n", "\n", "- [MVC prgramming](http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller)\n", @@ -31,32 +33,14 @@ "input": [ "from __future__ import print_function # For py 2.7 compat\n", "\n", - "from IPython.html import widgets # Widget definitions\n", - "from IPython.display import display # Used to display widgets in the notebook" + "from IPython.html import widgets # Widget definitions.\n", + "from IPython.display import display # Used to display widgets in the notebook.\n", + "from IPython.utils.traitlets import Unicode # Used to declare properties of our widget." ], "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 19 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "The 3 part of this tutorial requires the 3rd party `dateutil` library. https://pypi.python.org/pypi/python-dateutil" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Import the dateutil library to parse date strings.\n", - "from dateutil import parser" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 20 + "prompt_number": 1 }, { "cell_type": "heading", @@ -100,24 +84,19 @@ "cell_type": "code", "collapsed": false, "input": [ - "# Import the base Widget class and the traitlets Unicode class.\n", - "from IPython.html.widgets import DOMWidget\n", - "from IPython.utils.traitlets import Unicode\n", - "\n", - "# Define our DateWidget and its target model and default view.\n", - "class DateWidget(DOMWidget):\n", + "class DateWidget(widgets.DOMWidget):\n", " _view_name = Unicode('DatePickerView', sync=True)" ], "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 21 + "prompt_number": 2 }, { "cell_type": "markdown", "metadata": {}, "source": [ - "- **_view_name** is the default Backbone view to display when the user calls `display` to display an instance of this widget.\n" + "Our widget inherits from `widgets.DOMWidget` since it is intended that it will be displayed in the notebook directly. The `_view_name` trait is specially named, the widget framework will read the `_view_name` trait to determine what Backbone view the widget is associated with. **Using `sync=True` is very important** because it tells the widget framework that that specific traitlet should be synced between the front- and back-ends." ] }, { @@ -158,17 +137,17 @@ "metadata": {}, "output_type": "display_data", "text": [ - "" + "" ] } ], - "prompt_number": 22 + "prompt_number": 3 }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Now we need to define a view that can be used to represent the model. To do this, the `IPython.DOMWidgetView` is extended. A render function must be defined. The render function is used to render a widget view instance to the DOM. For now the render function renders a div that contains the text *Hello World!* Lastly, the view needs to be registered with the widget manager like the model was.\n", + "Now we need to define a view that can be used to represent the model. To do this, the `IPython.DOMWidgetView` is extended. A render function must be defined. The render function is used to render a widget view instance to the DOM. For now the render function renders a div that contains the text *Hello World!* Lastly, the view needs to be registered with the widget manager.\n", "\n", "**Final JavaScript code below:**" ] @@ -210,11 +189,11 @@ "metadata": {}, "output_type": "display_data", "text": [ - "" + "" ] } ], - "prompt_number": 23 + "prompt_number": 4 }, { "cell_type": "heading", @@ -240,7 +219,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 24 + "prompt_number": 5 }, { "cell_type": "heading", @@ -262,26 +241,21 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "In the last section we created a simple widget that displayed *Hello World!* To make an actual date widget, we need to add a property that will be synced between the Python model and the JavaScript model. The new property must be a traitlet property so the widget machinery can automatically handle it. The property needs to be constructed with a `sync=True` keyword argument so the widget machinery knows to syncronize it with the fron-end. Adding this to the code from the last section:" + "In the last section we created a simple widget that displayed *Hello World!* To make an actual date widget, we need to add a property that will be synced between the Python model and the JavaScript model. The new property must be a traitlet property so the widget machinery can automatically handle it. The property needs to be constructed with a `sync=True` keyword argument so the widget machinery knows to syncronize it with the front-end. Adding this to the code from the last section:" ] }, { "cell_type": "code", "collapsed": false, "input": [ - "# Import the base Widget class and the traitlets Unicode class.\n", - "from IPython.html.widgets import DOMWidget\n", - "from IPython.utils.traitlets import Unicode\n", - "\n", - "# Define our DateWidget and its target model and default view.\n", - "class DateWidget(DOMWidget):\n", + "class DateWidget(widgets.DOMWidget):\n", " _view_name = Unicode('DatePickerView', sync=True)\n", " value = Unicode(sync=True)" ], "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 25 + "prompt_number": 6 }, { "cell_type": "heading", @@ -295,7 +269,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "In the JavaScript there is no need to define the same properties in the JavaScript model. When the JavaScript model is created for the first time, it copies all of the attributes from the Python model. We need to replace *Hello World!* with an actual HTML date picker widget." + "In the JavaScript there is no need to define counterparts to the traitlets. When the JavaScript model is created for the first time, it copies all of the traitlet `sync=True` attributes from the Python model. We need to replace *Hello World!* with an actual HTML date picker widget." ] }, { @@ -347,11 +321,11 @@ "metadata": {}, "output_type": "display_data", "text": [ - "" + "" ] } ], - "prompt_number": 26 + "prompt_number": 7 }, { "cell_type": "markdown", @@ -423,11 +397,11 @@ "metadata": {}, "output_type": "display_data", "text": [ - "" + "" ] } ], - "prompt_number": 27 + "prompt_number": 8 }, { "cell_type": "markdown", @@ -521,11 +495,11 @@ "metadata": {}, "output_type": "display_data", "text": [ - "" + "" ] } ], - "prompt_number": 28 + "prompt_number": 9 }, { "cell_type": "heading", @@ -552,7 +526,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 29 + "prompt_number": 10 }, { "cell_type": "markdown", @@ -570,7 +544,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 30 + "prompt_number": 11 }, { "cell_type": "markdown", @@ -591,13 +565,13 @@ { "metadata": {}, "output_type": "pyout", - "prompt_number": 31, + "prompt_number": 12, "text": [ - "u''" + "u'2014-01-01'" ] } ], - "prompt_number": 31 + "prompt_number": 12 }, { "cell_type": "markdown", @@ -615,7 +589,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 32 + "prompt_number": 13 }, { "cell_type": "heading", @@ -629,6 +603,25 @@ "cell_type": "markdown", "metadata": {}, "source": [ + "The 3rd party `dateutil` library is required to continue. https://pypi.python.org/pypi/python-dateutil" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Import the dateutil library to parse date strings.\n", + "from dateutil import parser" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ "In the last section we created a fully working date picker widget. Now we will add custom validation and support for labels. Currently only the ISO date format \"YYYY-MM-DD\" is supported. We will add support for all of the date formats recognized by the 3rd party Python dateutil library." ] }, @@ -644,96 +637,61 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The traitlet machinery searches the class that the trait is defined in for methods with \"`_changed`\" suffixed onto their names. Any method with the format \"`X_changed`\" will be called when \"`X`\" is modified. We can take advantage of this to perform validation and parsing of different date string formats. Below a method that listens to value has been added to the DateWidget." + "The standard property name used for widget labels is `description`. In the code block below, `description` has been added to the Python widget." ] }, { "cell_type": "code", "collapsed": false, "input": [ - "# Import the base Widget class and the traitlets Unicode class.\n", - "from IPython.html.widgets import DOMWidget\n", - "from IPython.utils.traitlets import Unicode\n", - "\n", - "# Define our DateWidget and its target model and default view.\n", - "class DateWidget(DOMWidget):\n", + "class DateWidget(widgets.DOMWidget):\n", " _view_name = Unicode('DatePickerView', sync=True)\n", " value = Unicode(sync=True)\n", - " \n", - " # This function automatically gets called by the traitlet machinery when\n", - " # value is modified because of this function's name.\n", - " def _value_changed(self, name, old_value, new_value):\n", - " pass\n", - " " + " description = Unicode(sync=True)" ], "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 33 + "prompt_number": 15 }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Now the function that parses the date string and only sets it in the correct format can be added." + "The traitlet machinery searches the class that the trait is defined in for methods with \"`_changed`\" suffixed onto their names. Any method with the format \"`X_changed`\" will be called when \"`X`\" is modified. We can take advantage of this to perform validation and parsing of different date string formats. Below a method that listens to value has been added to the DateWidget." ] }, { "cell_type": "code", "collapsed": false, "input": [ - "# Import the dateutil library to parse date strings.\n", - "from dateutil import parser\n", - "\n", - "# Import the base Widget class and the traitlets Unicode class.\n", - "from IPython.html.widgets import DOMWidget\n", - "from IPython.utils.traitlets import Unicode\n", - "\n", - "# Define our DateWidget and its target model and default view.\n", - "class DateWidget(DOMWidget):\n", + "class DateWidget(widgets.DOMWidget):\n", " _view_name = Unicode('DatePickerView', sync=True)\n", " value = Unicode(sync=True)\n", - " \n", + " description = Unicode(sync=True)\n", + "\n", " # This function automatically gets called by the traitlet machinery when\n", " # value is modified because of this function's name.\n", " def _value_changed(self, name, old_value, new_value):\n", - " \n", - " # Parse the date time value.\n", - " try:\n", - " parsed_date = parser.parse(new_value)\n", - " parsed_date_string = parsed_date.strftime(\"%Y-%m-%d\")\n", - " except:\n", - " parsed_date_string = ''\n", - " \n", - " # Set the parsed date string if the current date string is different.\n", - " if self.value != parsed_date_string:\n", - " self.value = parsed_date_string" + " pass" ], "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 34 + "prompt_number": 16 }, { "cell_type": "markdown", "metadata": {}, "source": [ - "The standard property name used for widget labels is `description`. In the code block below, `description` has been added to the Python widget." + "Now the function that parses the date string and only sets it in the correct format can be added." ] }, { "cell_type": "code", "collapsed": false, "input": [ - "# Import the dateutil library to parse date strings.\n", - "from dateutil import parser\n", - "\n", - "# Import the base Widget class and the traitlets Unicode class.\n", - "from IPython.html.widgets import DOMWidget\n", - "from IPython.utils.traitlets import Unicode\n", - "\n", - "# Define our DateWidget and its target model and default view.\n", - "class DateWidget(DOMWidget):\n", + "class DateWidget(widgets.DOMWidget):\n", " _view_name = Unicode('DatePickerView', sync=True)\n", " value = Unicode(sync=True)\n", " description = Unicode(sync=True)\n", @@ -756,13 +714,13 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 35 + "prompt_number": 17 }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Finally, a callback list is added so the user can perform custom validation. If any one of the callbacks returns False, the new date time is not set.\n", + "Finally, a `CallbackDispatcher` is added so the user can perform custom validation. If any one of the callbacks registered with the dispatcher returns False, the new date time is not set.\n", "\n", "**Final Python code below:**" ] @@ -771,15 +729,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "# Import the dateutil library to parse date strings.\n", - "from dateutil import parser\n", - "\n", - "# Import the base Widget class and the traitlets Unicode class.\n", - "from IPython.html.widgets import DOMWidget, CallbackDispatcher\n", - "from IPython.utils.traitlets import Unicode\n", - "\n", - "# Define our DateWidget and its target model and default view.\n", - "class DateWidget(DOMWidget):\n", + "class DateWidget(widgets.DOMWidget):\n", " _view_name = Unicode('DatePickerView', sync=True)\n", " value = Unicode(sync=True)\n", " description = Unicode(sync=True)\n", @@ -790,7 +740,7 @@ " # Specify the number of positional arguments supported. For \n", " # validation we only are worried about one parameter, the\n", " # new value that should be validated.\n", - " self.validation = CallbackDispatcher(acceptable_nargs=[1])\n", + " self.validation = widgets.CallbackDispatcher(acceptable_nargs=[1])\n", " \n", " # This function automatically gets called by the traitlet machinery when\n", " # value is modified because of this function's name.\n", @@ -817,7 +767,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 45 + "prompt_number": 18 }, { "cell_type": "heading", @@ -953,11 +903,11 @@ "metadata": {}, "output_type": "display_data", "text": [ - "" + "" ] } ], - "prompt_number": 40 + "prompt_number": 19 }, { "cell_type": "heading", @@ -989,7 +939,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 46 + "prompt_number": 20 }, { "cell_type": "markdown", @@ -1012,7 +962,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 47 + "prompt_number": 21 }, { "cell_type": "code", @@ -1024,7 +974,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 48 + "prompt_number": 22 }, { "cell_type": "code", @@ -1036,7 +986,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 49 + "prompt_number": 23 }, { "cell_type": "code", @@ -1050,13 +1000,20 @@ { "metadata": {}, "output_type": "pyout", - "prompt_number": 50, + "prompt_number": 24, "text": [ "u'2014-12-02'" ] } ], - "prompt_number": 50 + "prompt_number": 24 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This concludes Part 6 of the [series](index.ipynb)." + ] } ], "metadata": {} diff --git a/examples/widgets/index.ipynb b/examples/widgets/index.ipynb new file mode 100644 index 0000000..13d545b --- /dev/null +++ b/examples/widgets/index.ipynb @@ -0,0 +1,70 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Widgets" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This directory includes a tutorial and collection of examples related to the IPython notebook widget framework." + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Tutorial" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "- [Part 1 - Basics](Part 1 - Basics.ipynb) \n", + "- [Part 2 - Events](Part 2 - Events.ipynb) \n", + "- [Part 3 - Placement](Part 3 - Placement.ipynb) \n", + "- [Part 4 - Styles](Part 4 - Styles.ipynb) \n", + "- [Part 5 - Alignment](Part 5 - Alignment.ipynb) \n", + "- [Part 6 - Custom Widget](Part 6 - Custom Widget.ipynb) " + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Examples" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "- [Widget Tester](Widget Tester.ipynb) \n", + "- [Variable Inspector](Variable Inspector.ipynb) \n", + "- [Export As (nbconvert)](Export As (nbconvert%29.ipynb) \n", + "- [Nonblocking Console](Nonblocking Console.ipynb) \n", + "- [D3](D3.ipynb) \n", + "- [File Upload Widget](File Upload Widget.ipynb) \n", + "- [Dialogs](Dialogs.ipynb) " + ] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file