我在 Jupyter Notebook 中有一个 Python 程序,它使用 ipywidgets
模块中的 interact
。
interact(my_func, filter_by=filter_by_list, format_type=format_dict.keys())
我希望有人能够在某处的网站上打开笔记本并使用交互式小部件,而不需要 Python 或其他任何东西,就像 here .
最佳答案
您可以查看此网站: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 文件。
关于javascript - 将 ipywidgets 导出到网站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43254861/