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