我是bokeh的新手,我有关于button onclick事件的知识,代码如下:
x = widgetbox(button)
show(x)
fruits = ['Answered', 'Unanswered','Total']
top1=[1,2,3]
def callback():
p = figure(x_range=fruits, plot_height=250, title="sophia bot")
p.vbar(x=fruits, top=top1, width=0.9)
p.xgrid.grid_line_color = None
p.y_range.start = 0
output_file("abc.html")
show(p)
button_one = Button(label="Start", disabled=True, callback=callback)
show(button_one)
但这不是执行动作,下面的代码单独使用时,会绘制出图形,我希望在单击按钮时显示图形。
fruits = ['Answered', 'Unanswered','Total']
top1=[1,2,3]
p = figure(x_range=fruits, plot_height=250, title="sophia bot")
p.vbar(x=fruits, top=top1, width=0.9)
p.xgrid.grid_line_color = None
p.y_range.start = 0
output_file("abc.html")
show(p)
谢谢
目前没有回答
相关问题 更多 >
编程相关推荐