1

Can anyone give me some background information on how bokeh callbacks in bokeh server 2.3.0 work internally?
If I edit a bokeh object within a callback, the updated object only is displayed, when the callback just finished.
In the small example below, I would expect to see "Calculation Started..." for about 5 seconds before "Calculation Done..." is showed.

import time
from bokeh.plotting import  curdoc
from bokeh.models import  Button, Div
from bokeh.layouts import Column

def function_that_takes_some_time():
    time.sleep(5)

def callback(event):
    status_text.text = "Calculation Started..."
    function_that_takes_some_time()
    status_text.text = "Calculation Done..."

status_text = Div(text="Status: Calculation not started")

button_val = Button(label="Do Calculation")
button_val.on_click(callback)

curdoc().add_root(Column(status_text, button_val))

I guess Bokeh is designed to behave like this because of the JS - Python linking. However, I wonder if there is any way to achieve my expected behaviour of having a updated text in a callback before some longer calculation is done.
Thanks for any suggestions.

Crysers
  • 455
  • 2
  • 13
  • The answer can be found in [this SO question](https://stackoverflow.com/questions/59196855/python-bokeh-markup-text-value-cant-update/59199773#59199773) – Crysers Jan 10 '22 at 07:23

0 Answers0