将 ipywidget 导出到网站

Imr*_*ran 5 html javascript python jupyter-notebook ipywidgets

我在 Jupyter Notebook 中有一个 Python 程序,它使用interact模块ipywidgets.

interact(my_func, filter_by=filter_by_list, format_type=format_dict.keys())
Run Code Online (Sandbox Code Playgroud)

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

yl_*_*low 7

您可以查看此网站: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')
Run Code Online (Sandbox Code Playgroud)

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

  • 两年后,它变得非常小,几乎无法使用。 (4认同)