ipywidgets
                                
                                 ipywidgets copied to clipboard
                                
                                    ipywidgets copied to clipboard
                            
                            
                            
                        Updating widget value from within function
I'm using a slider and interact to set the value of a parameter in a function. Under certain conditions, I want the function to be able to modify the value of the slider itself so that the position of the slider (being displayed in an interact window outside of the function) changes when the variable is updated. In other words, I want the relationship between the slider and the variable to be two-way, not one-way. Here are two ways I can think of doing this:
- Bind the variable to the slider so that the slider position changes whenever the variable changes.
- Pass in the widget object to the function and modify slider.valuedirectly.
Are either of these supported and if so, how should they be implemented?
Option 2 would be easy, since you can pass an existing slider into the interact, then just use that same slider in your function.