【发布时间】:2023-03-08 11:15:02
【问题描述】:
这里是重现错误的完整代码示例。我可以在以前版本的 Bokeh 中执行此操作,但升级此代码后不再允许我向 GridBox 添加 div。
from bokeh.models import Panel, Tabs
from bokeh.io import output_file, show
from bokeh.plotting import figure
from bokeh.io import curdoc
from bokeh.models.widgets import Div
from bokeh.layouts import gridplot
p1 = figure(plot_width=300, plot_height=300)
p1.circle([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], size=20, color="navy", alpha=0.5)
p2 = figure(plot_width=300, plot_height=300)
p2.circle([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], size=20, color="navy", alpha=0.5)
p3 = figure(plot_width=300, plot_height=300)
p3.circle([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], size=20, color="navy", alpha=0.5)
p4 = figure(plot_width=300, plot_height=300)
p4.circle([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], size=20, color="navy", alpha=0.5)
g1 = gridplot([p1, p2, p3, p4], ncols=2, plot_width=800, plot_height=600)
tab1 = Panel(child=g1, title="circle")
tabs = Tabs(tabs=[ tab1 ])
doc = curdoc()
doc.add_root(tabs)
my_div = Div(text="Please wait...")
doc._roots[0].tabs[0].child.children[1].children.append(my_div)
这是我收到的错误消息,
ValueError: 期望一个元素 列表(要么(元组(实例(LayoutDOM),Int,Int), Tuple(Instance(LayoutDOM), Int, Int, Int, Int))),得到无效的 seq 项目 [Div(id='2515', ...)]
【问题讨论】: