File tree 1 file changed +28
-5
lines changed 1 file changed +28
-5
lines changed Original file line number Diff line number Diff line change @@ -422,6 +422,13 @@ def _update(self, event):
422
422
self .set_val (val )
423
423
424
424
def set_val (self , val ):
425
+ """
426
+ Set slider value to *val*
427
+
428
+ Parameters
429
+ ----------
430
+ val : float
431
+ """
425
432
xy = self .poly .xy
426
433
xy [2 ] = val , 1
427
434
xy [3 ] = val , 0
@@ -437,25 +444,41 @@ def set_val(self, val):
437
444
438
445
def on_changed (self , func ):
439
446
"""
440
- When the slider value is changed, call *func* with the new
441
- slider position
447
+ When the slider value is changed call *func* with the new
448
+ slider value
442
449
443
- A connection id is returned which can be used to disconnect
450
+ Parameters
451
+ ----------
452
+ func : callable
453
+ Function to call when slider is changed.
454
+ The function must accept a single float as its arguments.
455
+
456
+ Returns
457
+ -------
458
+ cid : int
459
+ Connection id (which can be used to disconnect *func*)
444
460
"""
445
461
cid = self .cnt
446
462
self .observers [cid ] = func
447
463
self .cnt += 1
448
464
return cid
449
465
450
466
def disconnect (self , cid ):
451
- """remove the observer with connection id *cid*"""
467
+ """
468
+ Remove the observer with connection id *cid*
469
+
470
+ Parameters
471
+ ----------
472
+ cid : int
473
+ Connection id of the observer to be removed
474
+ """
452
475
try :
453
476
del self .observers [cid ]
454
477
except KeyError :
455
478
pass
456
479
457
480
def reset (self ):
458
- """reset the slider to the initial value if needed """
481
+ """Reset the slider to the initial value"""
459
482
if (self .val != self .valinit ):
460
483
self .set_val (self .valinit )
461
484
You can’t perform that action at this time.
0 commit comments