Description
Problem
If you want to directly modify the current value of a slider generated by this package it is very difficult. Currently it is undocumented, and confusingly/difficult would be a kind way of putting it. For example see the discussion in #181 about using controls.controls['tau'].children[0]
.
There needs to be an easier (and documented!!) way to change the attributes of the sliders.
Proposed Solutions
Create an abstract Slider class
Create a Slider like object that abstracts over matplotlib and ipywidgets sliders. It could have it's own set of documented methods or take on the important methods of both maptlotlib sliders and ipywidgets sliders
pros:
- Uniform user facing API for matplotlib and ipywidgets sliders
- Don't have to replicate every method, just the important ones
- Is perhaps a reasonable way to leave the door open to other slider libs in the future
- Less need to explain the nightmare of
HBox
es for ipywidgets sliders
cons:
- Have to replicate two different APIs
- users will not get direct access to the slider
- well they could with some explanation
- using
type
on this may be a confusing experience- relatedly, what if it gets passed back into a controls object
I think the last point really only matters if you pass in an explicitly created slider, and then expect to get it back. Though hopefully this isn't too common.
Methods for setting on the controls object
e.g. controls.set_param_value('tau', 5)
pros:
- Easiest to implement
cons:
- Doesn't really give full functionality (what about setting the slider label)
- What about non-slider widgets?
Easy access to the underlying sliders
pros:
- pretty easy to implement
cons:
- Do we give back the whole hbox for ipywidgets sliders?
Looking at this there might be argument for doing all three. Or perhaps just the first two.
If we don't go with the first option then there will need to be a docs page explaining the nonsense with HBox
s for ipywidgets sldiers.
Additional context
I have no idea how if theres any reasonable way to have a depcreation path here, I suppose it would require keeping the .controls
attribute with a warning on access and moving to some