我一直在Jupyter笔记本中使用I Python小部件,但是我所依赖的用于启用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)