使用Bokeh绘图出现如下报错
AttributeError: unexpected attribute 'callback' to CheckboxGroup, similar attributes are js_event_callbacks
解决:
将
checkbox.callback = CustomJS(args=dict(l0=l0, l1=l1, l2=l2, checkbox=checkbox), code="""
l0.visible = 0 in checkbox.active;
l1.visible = 1 in checkbox.active;
l2.visible = 2 in checkbox.active;
""")
改为
callback = CustomJS(args=dict(l0=l0, l1=l1, l2=l2, checkbox=checkbox), code="""
l0.visible = 0 in checkbox.active;
l1.visible = 1 in checkbox.active;
l2.visible = 2 in checkbox.active;
""")
checkbox.js_on_change('active', callback) # js_on_change的第一个参数为需要改变的参数