设置值#

bokeh.models 中按钮的可视化。此示例演示了当某个事件(如点击按钮)发生时,如何更改对象的值。

详情

Bokeh APIs:

bokeh.io.show, bokeh.models.Button, Bokeh.models.SetValue

More info:

SetValue 回调

Keywords:

js 回调函数

from bokeh.io import show
from bokeh.models import Button, SetValue

button = Button(label="Foo", button_type="primary")
callback = SetValue(obj=button, attr="label", value="Bar")
button.js_on_event("button_click", callback)

show(button)