☰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

RangeSlider on_change

Community Support
Tommy_Carstensen
Tommy_Carstensen

I’ve noticed that the RangeSlider range property is updated, while one drags the slider. That leads to a lot of data updates and slows down things. Is it possible to only have the RangeSlider range property be updated upon releasing the mouse button? Or is it possible to update it less frequently while dragging it? Otherwise I’ll have to specify the range with two text boxes instead. Thanks!

⌁   Link to post
nicain
nicain

I can’t remember where I learned to do this, but the following will give you the update-on-mouse-release behavior:

from bokeh.layouts import column, widgetbox

from bokeh.models import CustomJS, ColumnDataSource, Slider

from bokeh.io import curdoc

source = ColumnDataSource(data=dict(value=))

def callback(attr, old, new):

Implement what you want to happen when the slider is changed here:

print slider.value

slider = Slider(start=0.1, end=4, value=1, step=.1, title=“Slider”, callback_policy=‘mouseup’)

slider.callback = CustomJS(args=dict(source=source), code=‘source.data = { value: [cb_obj.value] }’)

source.on_change(‘data’, callback)

layout = column(slider)

curdoc().add_root(widgetbox(slider))

curdoc().title = “Sliders”

···

On Wednesday, March 29, 2017 at 8:42:04 AM UTC-7, Tommy Carstensen wrote:

I’ve noticed that the RangeSlider range property is updated, while one drags the slider. That leads to a lot of data updates and slows down things. Is it possible to only have the RangeSlider range property be updated upon releasing the mouse button? Or is it possible to update it less frequently while dragging it? Otherwise I’ll have to specify the range with two text boxes instead. Thanks!

⌁   Link to post
Tommy_Carstensen
Tommy_Carstensen

Thanks a lot nicain! It’s actually well documented:
http://bokeh.pydata.org/en/latest/docs/reference/models/widgets.inputs.html#bokeh.models.widgets.inputs.RangeSlider.callback_policy

There was an issue on GitHub about this in 2016:

https://github.com/bokeh/bokeh/issues/4540

Which refers this solution on StackOverflow:

http://stackoverflow.com/questions/38375961/throttling-in-bokeh-application

Totally unrelated. I just came across this great index page, which is not linked to from anywhere, but I found it via a Google search:

http://bokeh.pydata.org/en/latest/genindex.html

···

On Wed, 29 Mar 2017 at 18:05 nicain nicain.seattle@gmail.com wrote:

I can’t remember where I learned to do this, but the following will give you the update-on-mouse-release behavior:

from bokeh.layouts import column, widgetbox

from bokeh.models import CustomJS, ColumnDataSource, Slider

from bokeh.io import curdoc

source = ColumnDataSource(data=dict(value=))

def callback(attr, old, new):

Implement what you want to happen when the slider is changed here:

print slider.value

slider = Slider(start=0.1, end=4, value=1, step=.1, title=“Slider”, callback_policy=‘mouseup’)

slider.callback = CustomJS(args=dict(source=source), code=‘source.data = { value: [cb_obj.value] }’)

source.on_change(‘data’, callback)

layout = column(slider)

curdoc().add_root(widgetbox(slider))

curdoc().title = “Sliders”

On Wednesday, March 29, 2017 at 8:42:04 AM UTC-7, Tommy Carstensen wrote:

I’ve noticed that the RangeSlider range property is updated, while one drags the slider. That leads to a lot of data updates and slows down things. Is it possible to only have the RangeSlider range property be updated upon releasing the mouse button? Or is it possible to update it less frequently while dragging it? Otherwise I’ll have to specify the range with two text boxes instead. Thanks!

–

You received this message because you are subscribed to a topic in the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/nwkfeLbvgUg/unsubscribe.

To unsubscribe from this group and all its topics, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/80775795-a2e6-4df3-b1e9-cc902bbb0906%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post
Bryan
Bryan

It would be simple enough to add a link to the Sphinx generated index. Please feel free to open a GitHub issue.

Thanks,

Bryan

···

On Mar 29, 2017, at 15:16, Tommy Carstensen <tommy.carstensen@gmail.com> wrote:

Thanks a lot nicain! It's actually well documented:
http://bokeh.pydata.org/en/latest/docs/reference/models/widgets.inputs.html#bokeh.models.widgets.inputs.RangeSlider.callback_policy

There was an issue on GitHub about this in 2016:
Slider callback_policy should work for apps · Issue #4540 · bokeh/bokeh · GitHub

Which refers this solution on StackOverflow:
http://stackoverflow.com/questions/38375961/throttling-in-bokeh-application

Totally unrelated. I just came across this great index page, which is not linked to from anywhere, but I found it via a Google search:
Index — Bokeh 3.3.2 Documentation

On Wed, 29 Mar 2017 at 18:05 nicain <nicain.seattle@gmail.com> wrote:
I can't remember where I learned to do this, but the following will give you the update-on-mouse-release behavior:

from bokeh.layouts import column, widgetbox
from bokeh.models import CustomJS, ColumnDataSource, Slider
from bokeh.io import curdoc

source = ColumnDataSource(data=dict(value=))

def callback(attr, old, new):
    
    # Implement what you want to happen when the slider is changed here:
    print slider.value

slider = Slider(start=0.1, end=4, value=1, step=.1, title="Slider", callback_policy='mouseup')
slider.callback = CustomJS(args=dict(source=source), code='source.data = { value: [cb_obj.value] }')

source.on_change('data', callback)

layout = column(slider)
curdoc().add_root(widgetbox(slider))
curdoc().title = "Sliders"

On Wednesday, March 29, 2017 at 8:42:04 AM UTC-7, Tommy Carstensen wrote:
I've noticed that the RangeSlider range property is updated, while one drags the slider. That leads to a lot of data updates and slows down things. Is it possible to only have the RangeSlider range property be updated upon releasing the mouse button? Or is it possible to update it less frequently while dragging it? Otherwise I'll have to specify the range with two text boxes instead. Thanks!

--
You received this message because you are subscribed to a topic in the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/nwkfeLbvgUg/unsubscribe\.
To unsubscribe from this group and all its topics, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/80775795-a2e6-4df3-b1e9-cc902bbb0906%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CACscrJ8m1FNmtCDpfHx-xXnHv%2BnDi%2BvKVDvgY-cSuo98y%3D7Y4Q%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post

End of archived discussion · Replies are disabled