☰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

Slider 'mouseup' in app not working?

Community Support
noamnav
noamnav

Hi, I am failing to get the slider ‘mouseup’ or ‘throttle’ functionality to work using python callbacks.
Is this at all possible? anything wrong with the object’s initiation?

from bokeh.models.widgets import Slider

#notebook environment
from bokeh.io import show, output_notebook
output_notebook()

#Boeh server models
from bokeh.server.server import Server
from bokeh.application import Application
from bokeh.application.handlers.function import FunctionHandler

slider = Slider (start=0, end=100, value=0, step=1, title='slider', callback_policy = 'mouseup')

def callback (attr, old, new):
    print ('callback')

def make_doc (doc): 
    
    slider.on_change('value', callback)
    
    doc.add_root(slider)
    
#Bokeh server initiation and activation
handler = FunctionHandler(make_doc)
app = Application(handler)
server = Server(app, port=5000)
server.start() 
show (app, 'localhost=5000')
⌁   Link to post
Bryan
Bryan

Only with Bokeh 1.2 or later. In versions prior to that, these options only affected JavaScript callbacks, not Python ones. However, there is a new property "value_throttled" to watch for the Python callback case:

slider.on_change('value_throttled', callback)

To maintain current major version compatibility, the policy option still affects JS callback behavior for "value", as it has previously. But note that starting in Bokeh 2.0 the policy properties will be removed, and for both Python and JS callbacks: the "value" will always update on every slider movement, and "value_throttled" will always update only on mouseup. Instead of setting a policy, you will choose whichever you want to respond to (or even both, which is not possible currently).

⌁   Link to post

End of archived discussion · Replies are disabled