我一直在Jupyter笔记本电脑中使用iPython widgets,但我所依赖的启用App模式的扩展不起作用,所以我决定尝试将其全部重写为Python/Flask,但我不知道如何,或者是否有可能,在Flask视图中使用iPython小部件(尤其是交互式)?在
import ipywidgets as widgets
items_layout = widgets.Layout(flex='1 1 auto',
width='400px', height='200px')
box_layout = widgets.Layout(display='flex',
flex_flow='row',
align_items='stretch',
width='100%')
instruction = widgets.Textarea(description="Command",
value = "",
layout = items_layout)
code = widgets.Textarea(description="Code",
value = "",
layout = items_layout)
interactive_plot = widgets.interactive(run_code, trigger = instruction)
items = [interactive_plot, code]
box = widgets.Box(children=items, layout=box_layout)
display(box)
下面是来自ipywidgets存储库issue关于类似主题的响应。在
在web服务中使用ipywidgets的Example。在
但是,您将无法用Python编写小部件代码。小部件的整个显示都是用JavaScript代码完成的。在
相关问题 更多 >
编程相关推荐