☰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

Callback_policy="mouseup" doesn't works as expected

Community Support
ahmettemiz88
ahmettemiz88

Hi,

callback_policy=“mouseup” doesn’t works as expected. It responds every steps of the rangeslider.

Here is the related code fragment:

callback = CustomJS(args=dict(...  ), code=code )

range_slider = RangeSlider(start=0.0, end=0.85, value=(0,0.85), step=0.01 , title="Deprem Tehlike Değeri",callback=callback, callback_policy="mouseup" )

what am I doing wrong
regards

⌁   Link to post
carolyn
carolyn

Hi ahmettemiz88,

It doesn’t look like anything in your code fragment is wrong. I worked up a little example with it to show the ‘mouseup’ callback_policy in action:

from bokeh.models import RangeSlider, CustomJS, ColumnDataSource
from bokeh.plotting import show, figure
from bokeh.layouts import column

p = figure(y_range=[0, 4])

cds = ColumnDataSource(data={
'x': [1, 2, 3, 4, 5, 6, 7, 8],
'y': [1, 2, 3, 2, 1, 2, 3, 2],
'y_2': [1, 2, 3, 2, 1, 2, 3, 2]
})

line_to_change = p.line(x='x', y='y_2', color='green', source=cds)

callback = CustomJS(args=dict(source=cds), code='''
for (i=0; i<source.data['y_2'].length; i++) {
    source.data['y_2'][i] = source.data['y'][i] + this.value[0];  //  lower bound from RangeSlider
};
source.change.emit();
''')

range_slider = RangeSlider(start=0.0, end=0.85, value=(0,0.85), step=0.01,
                       title="Deprem Tehlike Değeri", callback=callback,
                       callback_policy="mouseup")

col = column(p, range_slider)
show(col)

If you move the lower end of the RangeSlider, you can see that the plot updates only when you drop the slider. (It’s not listening to the top end, so moving that won’t do anything. :slight_smile: )

If you’re still having trouble, I recommend posting a fully runnable minimal example with the behavior you’re seeing.

⌁   Link to post
Bryan
Bryan

FYI for anyone else this change was described in the 1.2.0 release notes:

⌁   Link to post

End of archived discussion · Replies are disabled