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