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

Analyze checkbox callback #19 #20

Draft
wants to merge 3 commits into
base: stable
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions FailingNotebook.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from ipywidgets import Label, Button, AppLayout, Checkbox, HBox, VBox, Output\n",
"\n",
"show = Button(description='Click me')\n",
"out = Output()\n",
"\n",
"@out.capture(clear_output=True)\n",
"def callback(*args):\n",
" print(args[0])\n",
"\n",
"class Container(VBox):\n",
" \n",
" def __init__(self, **kwargs):\n",
" self.main = HBox()\n",
" super().__init__(children=[self.main], **kwargs)\n",
" \n",
" def load(self, *args):\n",
" check1 = Checkbox(description=\"test1\")\n",
" check1.observe(callback, 'value')\n",
" check2 = Checkbox(description=\"test2\")\n",
" check2.observe(callback, 'value')\n",
" self.main.children = (check1, check2)\n",
"\n",
"center = Container()\n",
"\n",
"show.on_click(center.load)\n",
" \n",
"AppLayout(\n",
" header=None,\n",
" left_sidebar=VBox((Label(description=\"hello\"), show, )),\n",
" center=center,\n",
" right_sidebar=None,\n",
" footer=out\n",
")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:voila]",
"language": "python",
"name": "conda-env-voila-py"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# voila-material

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/voila-dashboards/voila-material/master?urlpath=voila)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/voila-dashboards/voila-material/stable?urlpath=voila)

Material design template for voila

Expand Down
3 changes: 2 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ channels:
dependencies:
- ipywidgets=7.5.1
- bqplot
- voila=0.1.12
- voila=0.1.21
- voila-material=0.3.0
33 changes: 30 additions & 3 deletions gaussian_process_regression.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"metadata": {},
"outputs": [],
"source": [
"fig_margin=dict(top=60, bottom=40, left=50, right=0)\n",
Expand Down Expand Up @@ -180,6 +178,35 @@
"fig.on_displayed(update_reg_line)\n",
"VBox([fig, VBox(check_boxes + [reset_button])])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"check_box = Checkbox(description=\"Broken checkbox\")\n",
"output = Output()\n",
"\n",
"@output.capture()\n",
"def callback(*args):\n",
" print(\"Called by checkbox\")\n",
"\n",
"check_box.observe(callback, 'value')\n",
"\n",
"VBox((check_box, output))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"@interact(a=True)\n",
"def interactive_f(a):\n",
" print(\"Interactive \" + str(a))\n"
]
}
],
"metadata": {
Expand Down
2 changes: 0 additions & 2 deletions postBuild

This file was deleted.