Suggestion: step_num for sliders

I have a suggestion:

a “step_num” attribute would be quite handy for sliders. At the moment I often change start and end of the slider with big changes in the range. Therefore I always have to manually recalculate the “step”.
It would be nice to be able to set the number of steps in the beginning, and “step” gets changed accordingly when I change start or end.

(btw. I didn’t find a suggestion category, so I thought community support is prob. the closest).

Hi @jonathansailing, for proposing features, a GitHub development discussion is a good place (but here is also fine).

From experience “properties that depend on other properties” are a huge PITA. If Bokeh was just a pure-Python tool, I might be inclined to consider these cases more. But having to worry about cross-runtime synchronization just opens too many questions and headaches. Basically is step and num_step are both independently user-settable, there are suddenly lots questions about how to enforce that that two properties stay consistent with respect to each other (and do those enforcements trigger their own cascading property updates or not?) And how to detect problem situations and warn about them (across runtime-boundaries). I can imagine this would need dozens of tests to maintain, and not the easy basic pure-Python unit tests, either, since BokehJS is in play.

And at the end of the day, all that work would be just to avoid this line:

slider.step = (slider.stop - slider.start) / N

Speaking plainly, I think it is unlikely that we would pursue this.

1 Like

In the interest of trying to stay constructively positive, a much easier ask would be a helper method:


That could be implemented and tested in a few lines of pure Python, does not add any new properties or introduce any new cross-runtime questions. We generally try to keep all our models “declarative”, i.e. just classes with properties, and without many or any methods or code. But we do sometimes add helpers for things like this, so it’s at least in the realm of possibility, in case you want to propose it on GH.

1 Like

Thanks, I don’t know that much about how this was implemented, and your explanation sounds sensible to me. Since indeed, this isn’t a big deal, I won’t request anything. Thanks for explaining though.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.