Skip to content

Commit a3ec10b

Browse files
NelleVMeeseeksDev[bot]
authored and
MeeseeksDev[bot]
committed
Backport PR #9517: Convert slider docstrings to numpydoc
1 parent 39daead commit a3ec10b

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

lib/matplotlib/widgets.py

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,13 @@ def _update(self, event):
414414
self.set_val(val)
415415

416416
def set_val(self, val):
417+
"""
418+
Set slider value to *val*
419+
420+
Parameters
421+
----------
422+
val : float
423+
"""
417424
xy = self.poly.xy
418425
xy[2] = val, 1
419426
xy[3] = val, 0
@@ -429,25 +436,41 @@ def set_val(self, val):
429436

430437
def on_changed(self, func):
431438
"""
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
434441
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*)
436452
"""
437453
cid = self.cnt
438454
self.observers[cid] = func
439455
self.cnt += 1
440456
return cid
441457

442458
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+
"""
444467
try:
445468
del self.observers[cid]
446469
except KeyError:
447470
pass
448471

449472
def reset(self):
450-
"""reset the slider to the initial value if needed"""
473+
"""Reset the slider to the initial value"""
451474
if (self.val != self.valinit):
452475
self.set_val(self.valinit)
453476

0 commit comments

Comments
 (0)