☰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

How to use js_on_click event to invoke Python code?

Community Support
DavidA2014
DavidA2014

Hi, I am new to bokeh. We have a small bokeh application that retrieves data from a remote source (using requests.get()) and plots that data using bokeh. I want to provide some buttons to select between remote source url’s.

So far, I have implemented a simple button:

button_4 = Button(label = "4", button_type = "light", min_width = 80) 
button_4.js_on_click(CustomJS(code = "console.log('button: You have clicked on button_4!')")) 

and I see the message in the browser console.

What I really want to do is to invoke some Python code in response to the js_on_click event, which will set a global variable to change the data source url and change the type (color) of the button to show which source is active. Reading other posts it seems I need to use ‘Bokeh server’. Could you provide some guidance on how to get started with that please?

⌁   Link to post

End of archived discussion · Replies are disabled