@@ -230,6 +230,12 @@ def disconnect(self, cid):
230
230
231
231
232
232
class SliderBase (AxesWidget ):
233
+ """
234
+ The base class for constructing Slider widgets. Not intended for direct
235
+ usage.
236
+
237
+ For the slider to remain responsive you must maintain a reference to it.
238
+ """
233
239
def __init__ (self , ax , orientation , closedmin , closedmax ,
234
240
valmin , valmax , valfmt , dragging , valstep ):
235
241
if ax .name == '3d' :
@@ -526,11 +532,12 @@ def on_changed(self, func):
526
532
527
533
class RangeSlider (SliderBase ):
528
534
"""
529
- A slider representing a floating point range.
535
+ A slider representing a range of floating point values. Defines the min and
536
+ max of the range via the *val* attribute as a tuple of (min, max).
530
537
531
- Create a slider from *valmin* to *valmax* in axes *ax*. For the slider to
532
- remain responsive you must maintain a reference to it. Call
533
- :meth:`on_changed` to connect to the slider event.
538
+ Create a slider that defines a range contained within [*valmin*, *valmax*]
539
+ in axes *ax*. For the slider to remain responsive you must maintain a
540
+ reference to it. Call :meth:`on_changed` to connect to the slider event.
534
541
535
542
Attributes
536
543
----------
@@ -724,14 +731,13 @@ def _format(self, val):
724
731
if self .valfmt is not None :
725
732
return f"({ self .valfmt % val [0 ]} , { self .valfmt % val [1 ]} )"
726
733
else :
727
- # fmt.get_offset is actually the multiplicative factor, if any.
728
734
_ , s1 , s2 , _ = self ._fmt .format_ticks (
729
735
[self .valmin , * val , self .valmax ]
730
736
)
731
737
# fmt.get_offset is actually the multiplicative factor, if any.
732
738
s1 += self ._fmt .get_offset ()
733
739
s2 += self ._fmt .get_offset ()
734
- # use raw string to avoid issues with backslashes from
740
+ # Use f string to avoid issues with backslashes when cast to a str
735
741
return f"({ s1 } , { s2 } )"
736
742
737
743
def set_min (self , min ):
0 commit comments