index
execution_count
cell_type
toolbar
started_at
completed_at
source
loc
metadata
outputs
1
unexecuted
In
[
]
markdown
# running `pidgy` in `voila`
this notebook demonstrates `pidgy` widget and [voila] integration.
[voila ]: https://voila.readthedocs.io/en/stable/customize.html
metadata
5
this notebook demonstrates
pidgy
widget and
voila
integration.
2
unexecuted
In
[
]
markdown
![image.png ](attachment:67317f74-f263-4b96-98a8-4f290f2b5611.png )
metadata
1
3
executed
In
[
1
]
code
# a blank line in pidgy suppressing the woven output
% reload_ext pidgy
shell . weave . template_type = "widget"
metadata
4
1 outputs.
Out
[
1
]
# a blank line in pidgy suppressing the woven output
%reload_ext pidgy
shell.weave.template_type = "widget"
4
unexecuted
In
[
]
markdown
## COOOKIES!
the cookies demo is a go to demo from Bret Viktor's [tanglejs].
[tanglejs ]: http://worrydream.com/Tangle/
metadata
5
the cookies demo is a go to demo from Bret Viktor's
tanglejs
.
5
executed
In
[
2
]
code
if you eat {{ cookies . value }} that you consume {{ cookies . value * calories }} calories .
metadata
1
1 outputs.
Out
[
2
]
6
executed
In
[
3
]
code
calories = 50
display ( cookies := IntSlider ( 3 , 1 , description = "COOKIES" ))
metadata
3
2 outputs.
Out
[
3
]
calories = 50
display(cookies := IntSlider(3, 1, description="COOKIES"))
7
executed
In
[
4
]
code
## `pidgy` widget integration
out of the box , ` pidgy ` relies on ` IPython ` s markdown display , but in this document we use the ` pidgy . displays . IPyWidgetsHtml ` display
shell . weave . template_cls = pidgy . displays . IPyWidgetsHtml
the reactive and asynchronous ` pidgy . displays . IPyWidgetsHtml ` display passes the input through a jinja environment then it is parsed into html by ` shell . weave . markdown_renderer ` .
after each exection we link undeclared variables in the jinja templates to any interactive widgets .
when widgets change , the display changes as shown in the COOOKIES demo .
metadata
11
1 outputs.
Out
[
4
]