☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Bokeh 2.0: Replacement for button.callback

Community Support
jnettels
jnettels

Hello there,

the same piece of code has worked since before Bokeh 1.0, but now its broken due to a deprecation in 2.0: “Additionally, the callback property is removed from all Bokeh models except CustomAction , HoverTool TapTool , and OpenURL . Instead, the more general js_on_change or js_on_event methods should be used”

Before I go through the trouble of creating a minimal example, I’ll hope someone might point me in the right direction. I just want to attach a CustomJS callback to a button press. With this I have created buttons for uploading and downloading data. In pseudocode:

source = ColumnDataSource()
button = Button()
code_upload = """some JavaScript code"""
button.callback = CustomJS(args=dict(source=source), code=code_upload)

Now, “button.callback” does not work anymore, of course. Simply trying to replace that with button.js_on_change or button.js_on_event yields the following error:

  File "C:\Users\...\anaconda3\envs\bokeh_test\lib\site-packages\bokeh\core\has_props.py", line 273, in __setattr__
    if name in props or (descriptor is not None and descriptor.fset is not None):
AttributeError: 'function' object has no attribute 'fset'

Is something like this supposed to work, or do I need a completely new approach to solve this?
Regards

⌁   Link to post

End of archived discussion · Replies are disabled