Skip to content
Snippets Groups Projects
Commit 0f24cfc1 authored by Rostislav Chudoba's avatar Rostislav Chudoba
Browse files

autostart in appmode
parent becb1184
Branches
Tags
No related merge requests found
# bmcsapps
Try this
[![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/rosoba/bmcsapps.git/master?urlpath=apps%2Findex.ipynb)
Start the application using the link
and then this
[![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/rosoba/bmcsapps.git/master?urlpath=apps%2Findex.ipynb)
[![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/binder-examples/appmode/master?urlpath=apps%2Findex.ipynb)
This diff is collapsed.
%% Cell type:markdown id: tags:
# Appmode in Jupyter
# BMCS applications
This page demonstrates how to generate online "apps" with a Jupyter Notebook interface. With the `appmode` plugin, we can create interactive experiences without requiring coding or running a specific cell.
Markdown cells will be retained, and all code cells will be run, then hidden. The outputs of each cell will be displayed as well.
Check out a further example using an [ipyvolume](https://ipyvolume.readthedocs.io/en/latest/) to render a 3D plot: [ipyvolume_demo.ipynb](ipyvolume_demo.ipynb)
- Test with of interaction on gnomon: [geo/gnomon.ipynb](geo/gnomon.ipynb)
- Pullout simulator: [notebooks/pullout1d.ipynb](notebooks/pullout1d.ipynb)
%% Cell type:code id: tags:
``` python
from __future__ import division
import ipywidgets as ipw
output = ipw.Text(placeholder="0", layout=ipw.Layout(width="190px"), disabled=True)
def on_click(btn):
if btn.description == "=":
try:
output.value = str(eval(output.value))
except:
output.value = "ERROR"
elif btn.description == "AC":
output.value = ""
elif btn.description == "del":
output.value = output.value[:-1]
else:
output.value = output.value + btn.description
def mk_btn(description):
btn = ipw.Button(description=description, layout=ipw.Layout(width="45px"))
btn.on_click(on_click)
return btn
row0 = ipw.HBox([mk_btn(d) for d in ("(", ")", "del", "AC")])
row1 = ipw.HBox([mk_btn(d) for d in ("7", "8", "9", " / ")])
row2 = ipw.HBox([mk_btn(d) for d in ("4", "5", "6", " * ")])
row3 = ipw.HBox([mk_btn(d) for d in ("1", "2", "3", " - ")])
row4 = ipw.HBox([mk_btn(d) for d in ("0", ".", "=", " + ")])
ipw.VBox((output, row0, row1, row2, row3, row4))
```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment