@@ -330,9 +330,8 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt=None,
330
330
closedmin = True , closedmax = True , slidermin = None ,
331
331
slidermax = None , dragging = True , valstep = None ,
332
332
orientation = 'horizontal' , * , initcolor = 'r' ,
333
- track_color = 'lightgrey' , handle_color_grabbed = None ,
334
- handle_color_released = 'white' , handle_edgecolor = '.75' ,
335
- handle_size = 10 , ** kwargs ):
333
+ track_color = 'lightgrey' , handle_facecolor = 'white' ,
334
+ handle_edgecolor = '.75' , handle_size = 10 , ** kwargs ):
336
335
"""
337
336
Parameters
338
337
----------
@@ -387,12 +386,8 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt=None,
387
386
The color of the backgrond track. The track is accesible for
388
387
further styling via the *track* attribute.
389
388
390
- handle_color_grabbed : color or None, default: None
391
- The color of the circular slider handle when grabbed. If *None*
392
- the same color as active part of the slider will be used.
393
-
394
- handle_color_released : color, default: 'white'
395
- The color of the circular slider handle when released.
389
+ handle_facecolor : color, default: 'white'
390
+ The facecolor of the circular slider handle.
396
391
397
392
handle_edgecolor : color, default: '.75'
398
393
The edgecolor of the circle slider handle.
@@ -448,16 +443,10 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt=None,
448
443
"o" ,
449
444
markersize = handle_size ,
450
445
markeredgecolor = handle_edgecolor ,
451
- markerfacecolor = handle_color_released ,
446
+ markerfacecolor = handle_facecolor ,
452
447
clip_on = False
453
448
)
454
449
455
- self ._handle_color_released = handle_color_released
456
- self ._handle_edgecolor = handle_edgecolor
457
- if handle_color_grabbed is None :
458
- handle_color_grabbed = self .poly .get_facecolor ()
459
- self ._handle_color_grabbed = handle_color_grabbed
460
-
461
450
if orientation == 'vertical' :
462
451
self .label = ax .text (0.5 , 1.02 , label , transform = ax .transAxes ,
463
452
verticalalignment = 'bottom' ,
@@ -520,13 +509,7 @@ def _update(self, event):
520
509
event .inaxes != self .ax )):
521
510
self .drag_active = False
522
511
event .canvas .release_mouse (self .ax )
523
- self ._handle .set_markeredgecolor (self ._handle_edgecolor )
524
- self ._handle .set_markerfacecolor (self ._handle_color_released )
525
- self .ax .figure .canvas .draw_idle ()
526
512
return
527
- if event .name == 'button_press_event' :
528
- self ._handle .set_markeredgecolor (self ._handle_color_grabbed )
529
- self ._handle .set_markerfacecolor (self ._handle_color_grabbed )
530
513
if self .orientation == 'vertical' :
531
514
val = self ._value_in_bounds (event .ydata )
532
515
else :
@@ -615,8 +598,7 @@ def __init__(
615
598
valstep = None ,
616
599
orientation = "horizontal" ,
617
600
track_color = 'lightgrey' ,
618
- handle_color_grabbed = None ,
619
- handle_color_released = 'white' ,
601
+ handle_facecolor = 'white' ,
620
602
handle_edgecolor = '.75' ,
621
603
handle_size = 10 ,
622
604
** kwargs ,
@@ -667,8 +649,8 @@ def __init__(
667
649
The color of the circular slider handles when grabbed. If *None*
668
650
the same color as active part of the slider will be used.
669
651
670
- handle_color_released : color, default: 'white'
671
- The color of the circular slider handles when released .
652
+ handle_facecolor : color, default: 'white'
653
+ The facecolor of the circular slider handle .
672
654
673
655
handle_edgecolor : color, default: '.75'
674
656
The edgecolor of the circular slider handles.
@@ -722,25 +704,19 @@ def __init__(
722
704
"o" ,
723
705
markersize = handle_size ,
724
706
markeredgecolor = handle_edgecolor ,
725
- markerfacecolor = handle_color_released ,
707
+ markerfacecolor = handle_facecolor ,
726
708
clip_on = False
727
709
)[0 ],
728
710
ax .plot (
729
711
* handleXY_2 ,
730
712
"o" ,
731
713
markersize = handle_size ,
732
714
markeredgecolor = handle_edgecolor ,
733
- markerfacecolor = handle_color_released ,
715
+ markerfacecolor = handle_facecolor ,
734
716
clip_on = False
735
717
)[0 ]
736
718
]
737
719
738
- self ._handle_color_released = handle_color_released
739
- self ._handle_edgecolor = handle_edgecolor
740
- if handle_color_grabbed is None :
741
- handle_color_grabbed = self .poly .get_facecolor ()
742
- self ._handle_color_grabbed = handle_color_grabbed
743
-
744
720
if orientation == "vertical" :
745
721
self .label = ax .text (
746
722
0.5 ,
@@ -835,10 +811,6 @@ def _update(self, event):
835
811
):
836
812
self .drag_active = False
837
813
event .canvas .release_mouse (self .ax )
838
- self .ax .figure .canvas .draw_idle ()
839
- for handle in self ._handles :
840
- handle .set_markeredgecolor (self ._handle_edgecolor )
841
- handle .set_markerfacecolor (self ._handle_color_released )
842
814
self ._active_handle = None
843
815
return
844
816
@@ -851,16 +823,7 @@ def _update(self, event):
851
823
# these checks ensure smooth behavior if the handles swap which one
852
824
# has a higher value. i.e. if one is dragged over and past the other.
853
825
if handle is not self ._active_handle :
854
- if self ._active_handle is not None :
855
- self ._active_handle .set_markeredgecolor (
856
- self ._handle_edgecolor
857
- )
858
- self ._active_handle .set_markerfacecolor (
859
- self ._handle_color_released
860
- )
861
826
self ._active_handle = handle
862
- self ._active_handle .set_markeredgecolor (self ._handle_color_grabbed )
863
- self ._active_handle .set_markerfacecolor (self ._handle_color_grabbed )
864
827
865
828
if self .orientation == "vertical" :
866
829
self ._update_val_from_pos (event .ydata )
0 commit comments