running pidgy
in voila
¤
this notebook demonstrates pidgy
widget and voila integration.
# a blank line in pidgy suppressing the woven output
%reload_ext pidgy
shell.weave.template_type = "widget"
# a blank line in pidgy suppressing the woven output
%reload_ext pidgy
shell.weave.template_type = "widget"
COOOKIES!¤
the cookies demo is a go to demo from Bret Viktor's tanglejs.
if you eat {{cookies.value}} that you consume {{cookies.value * calories}} calories.
calories = 50
display(cookies := IntSlider(3, 1, description="COOKIES"))
calories = 50
display(cookies := IntSlider(3, 1, description="COOKIES"))
## `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.