When I slide slider 1 it will go in a loop, slider 2 will update which will trigger slider 1 again,…
I was looking in the documentation if there was a way to change the value of the slider but not trigger an on_change but couldn’t find anything. Secondly, I was thinking of removing the on_change with remove_on_change and then add it afterwards again. Thirdly, I was thinking of using a blocking variable to be used inside the update function (if block is True ignore the calculation call)
What is in general a good approach to deal with this?
It's hard to say without specifics. Why are you updating both sliders in one callback for both? I can imagine a scenario where a user setting a first slider might update a second one as a result, but I can't imagine a situation where it would be useful for the second to also update the first (which is the problem). I guess the question is: what are you really, actually trying to accomplish (in plain language, without any mention of widgets or callbacks, or specific technology)
Thanks,
Bryan
···
On Sep 15, 2016, at 6:52 PM, Glenn Vanbavinckhove <[email protected]> wrote:
Hi,
Still learning bokeh. I run into an issue using sliders, which at the moment I am not sure what the correct way is to solve it.
Description:
I have multiple sliders. Some are dependent
Some example:
slider1.on_change('value',lambda attr, old, new:update())
slider2.on_change('value',lambda attr, old, new:update())
In my calculations:
val1=slider1.value
val2=slider2.value*val1**2
slider2.value=val2
When I slide slider 1 it will go in a loop, slider 2 will update which will trigger slider 1 again,...
I was looking in the documentation if there was a way to change the value of the slider but not trigger an on_change but couldn't find anything. Secondly, I was thinking of removing the on_change with remove_on_change and then add it afterwards again. Thirdly, I was thinking of using a blocking variable to be used inside the update function (if block is True ignore the calculation call)
What is in general a good approach to deal with this?
I will write a small example explaining my problem (after I finished something).
Best,
Glenn
···
On Saturday, September 17, 2016 at 2:17:12 AM UTC+10, Bryan Van de ven wrote:
It’s hard to say without specifics. Why are you updating both sliders in one callback for both? I can imagine a scenario where a user setting a first slider might update a second one as a result, but I can’t imagine a situation where it would be useful for the second to also update the first (which is the problem). I guess the question is: what are you really, actually trying to accomplish (in plain language, without any mention of widgets or callbacks, or specific technology)
Thanks,
Bryan
On Sep 15, 2016, at 6:52 PM, Glenn Vanbavinckhove [email protected] wrote:
Hi,
Still learning bokeh. I run into an issue using sliders, which at the moment I am not sure what the correct way is to solve it.
When I slide slider 1 it will go in a loop, slider 2 will update which will trigger slider 1 again,…
I was looking in the documentation if there was a way to change the value of the slider but not trigger an on_change but couldn’t find anything. Secondly, I was thinking of removing the on_change with remove_on_change and then add it afterwards again. Thirdly, I was thinking of using a blocking variable to be used inside the update function (if block is True ignore the calculation call)
What is in general a good approach to deal with this?
Thanks!
Best,
Glenn
–
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 [email protected].