wut-web-dev cruft input tests wtf

master
ml server 2020-01-23 18:18:47 -07:00
parent 279f24f230
commit 6900a4a772
1 changed files with 32 additions and 1 deletions

View File

@ -27,6 +27,37 @@
"import ipywidgets as widgets"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import time\n",
"from ipywidgets import Button\n",
"from jupyter_ui_poll import ui_events\n",
"\n",
"# Set up simple GUI, button with on_click callback\n",
"# that sets ui_done=True and changes button text\n",
"ui_done = False\n",
"def on_click(btn):\n",
" global ui_done\n",
" ui_done = True\n",
" btn.description = '👍'\n",
"\n",
"btn = Button(description='Click Me')\n",
"btn.on_click(on_click)\n",
"display(btn)\n",
"\n",
"# Wait for user to press the button\n",
"with ui_events() as poll:\n",
" while ui_done is False:\n",
" poll(10) # React to UI events (upto 10 at a time)\n",
" print('.', end='')\n",
" time.sleep(0.1)\n",
"print('done')"
]
},
{
"cell_type": "code",
"execution_count": null,
@ -45,7 +76,7 @@
")\n",
"\n",
"display(slider)\n",
"time.sleep(90) # move slider to 5"
"time.sleep(1) # move slider to 5"
]
},
{