Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace print statement with Output widget #2566

Merged
merged 1 commit into from
Jan 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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