Skip to content

Commit

Permalink
Autostart - added console_status.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Fleming committed May 5, 2024
1 parent 81e0169 commit ac194ee
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions examples/autostart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,16 @@
" tooltip=\"An error dialog will pop up when this is clicked.\\n\"\n",
" \"The dialog demonstrates the use of the `on_frontend_error` plugin.\",\n",
" )\n",
" console_button.on_click(lambda _: ma.load_console() if ma.console_status == \"unloaded\" else ma.unload_console())\n",
" console_button.on_click(\n",
" lambda _: ma.load_console(path=\"console\") if ma.console_status == \"unloaded\" else ma.unload_console()\n",
" )\n",
" error_button.on_click(lambda _: ma.executeCommand(\"Not a command\"))\n",
" console_status = ipw.HTML()\n",
" ipw.dlink((ma, \"console_status\"), (console_status, \"value\"))\n",
" ma.content.children = [\n",
" ipw.HTML(f\"<h3>My simple app</h3> Welcome to my app.<br> kernel id: {ma.kernelId}\"),\n",
" ipw.HBox([console_button, error_button]),\n",
" console_status,\n",
" ]\n",
"\n",
" # Shutdown when MainArea is unloaded.\n",
Expand Down Expand Up @@ -182,7 +187,18 @@
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
"source": [
"import ipywidgets as ipw"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ipw.Label"
]
}
],
"metadata": {
Expand All @@ -201,7 +217,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.10.14"
}
},
"nbformat": 4,
Expand Down

0 comments on commit ac194ee

Please sign in to comment.