将ipywidgets导出到网站

时间:2017-04-06 12:10:21

标签: javascript python html jupyter-notebook ipywidgets

我在Jupyter Notebook中有一个使用模块interact中的ipywidgets的Python程序。

interact(my_func, filter_by=filter_by_list, format_type=format_dict.keys())

我希望有人能够在某个网站上打开笔记本并使用交互式小部件而不需要Python或其他任何东西,就像here一样。

1 个答案:

答案 0 :(得分:2)

您可以访问此网站:http://ipywidgets.readthedocs.io/en/latest/embedding.html#python-interface

from ipywidgets import IntSlider
from ipywidgets.embed import embed_minimal_html

slider = IntSlider(value=40)
embed_minimal_html('export.html', views=[slider], title='Widgets export')

根据文档,它会生成一个export.html文件。