Skip to content

Commit 50889a7

Browse files
committed
Upgraded Chapter 01 Recipe 01 to IPython 4.0.0
1 parent 97d0b89 commit 50889a7

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

notebooks/chapter01_basic/01_notebook.ipynb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,8 @@
367367
"source": [
368368
"from collections import OrderedDict\n",
369369
"from IPython.display import display, clear_output\n",
370-
"from IPython.html.widgets import DropdownWidget"
370+
"from ipywidgets import Dropdown\n",
371+
"#from IPython.html.widgets import DropdownWidget # IPython < 4.x"
371372
]
372373
},
373374
{
@@ -378,10 +379,11 @@
378379
},
379380
"outputs": [],
380381
"source": [
381-
"# We create a DropdownWidget, with a dictionary containing\n",
382+
"# We create a Dropdown widget, with a dictionary containing\n",
382383
"# the keys (video name) and the values (Youtube identifier) \n",
383384
"# of every menu item.\n",
384-
"dw = DropdownWidget(values=OrderedDict([\n",
385+
"dw = Dropdown(options=OrderedDict([\n",
386+
"# dw = DropdownWidget(values=OrderedDict([ # IPython < 4.x\n",
385387
" ('SciPy 2012', 'iwVvqwLDsJo'), \n",
386388
" ('PyCon 2012', '2G5YTlheCbw'),\n",
387389
" ('SciPy 2013', 'j9YpkSX7NNM')]))\n",
@@ -395,7 +397,8 @@
395397
"# contains the value of the selected item.\n",
396398
"dw.on_trait_change(on_value_change, 'value')\n",
397399
"# We choose a default value.\n",
398-
"dw.value = dw.values['SciPy 2013']\n",
400+
"dw.value = dw.options['SciPy 2013']\n",
401+
"# dw.value = dw.values['SciPy 2013'] # IPyhon < 4.x\n",
399402
"# Finally, we display the widget.\n",
400403
"display(dw)"
401404
]
@@ -433,7 +436,7 @@
433436
"name": "python",
434437
"nbconvert_exporter": "python",
435438
"pygments_lexer": "ipython3",
436-
"version": "3.4.2"
439+
"version": "3.5.0"
437440
}
438441
},
439442
"nbformat": 4,

0 commit comments

Comments
 (0)