散景:删除已注册的on_change回调?

时间:2018-03-15 15:43:16

标签: bokeh

对于以下代码:

def foo(attr, old, new):
  print "Replacing value %s with %s" % (old, new)

selector = RadioButtonGroup(labels=["a", "b"], active=0)
selector.on_change("active", foo)

之后删除回调的正确方法是什么(即从选择器中分离foo?)

1 个答案:

答案 0 :(得分:0)

每个模型都有remove_on_change方法:

def foo(attr, old, new):
    ...
    selector.remove_on_change('active', foo)