Sunday 23 August 2020

How to get ipywidgets interact to work in HTML?

I have a Jupyter notebook with the following cell:

from ipywidgets import widgets, interact
slider = widgets.IntSlider()
def print_val(v):
  print(v)
interact(print_val,v=slider)

This works fine in the notebook - when I change the slider the printed output changes. But when I use nbconvert to convert the notebook into HTML, the slider still renders fine in the output HTML, but has no effect on the printed output.
Any idea how to get this to work? Maybe ipywidgets is not the right library for this kind of stuff?
Thanks!



from How to get ipywidgets interact to work in HTML?

No comments:

Post a Comment