Skip to content

Commit

Permalink
Merge pull request #2566 from davidbrochart/doc_fix
Browse files Browse the repository at this point in the history
Replace print statement with Output widget
  • Loading branch information
SylvainCorlay committed Jan 8, 2020
2 parents 60efe37 + 32efc24 commit 4fd70a7
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions docs/source/examples/Widget Asynchronous.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,29 @@
"metadata": {},
"outputs": [],
"source": [
"from ipywidgets import IntSlider\n",
"from ipywidgets import IntSlider, Output\n",
"slider = IntSlider()\n",
"out = Output()\n",
"\n",
"async def f():\n",
" for i in range(10):\n",
" print('did work %s'%i)\n",
" out.append_stdout('did work ' + str(i) + '\\n')\n",
" x = await wait_for_change(slider, 'value')\n",
" print('async function continued with value %s'%x)\n",
" out.append_stdout('async function continued with value ' + str(x) + '\\n')\n",
"asyncio.ensure_future(f())\n",
"\n",
"slider"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"out"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down

0 comments on commit 4fd70a7

Please sign in to comment.