Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5c95197

Browse files
committed
Convert slider docstrings to numpydoc
1 parent 201d536 commit 5c95197

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
@@ -422,6 +422,13 @@ def _update(self, event):
422422
self.set_val(val)
423423

424424
def set_val(self, val):
425+
"""
426+
Set slider value to *val*
427+
428+
Parameters
429+
----------
430+
val : float
431+
"""
425432
xy = self.poly.xy
426433
xy[2] = val, 1
427434
xy[3] = val, 0
@@ -437,25 +444,41 @@ def set_val(self, val):
437444

438445
def on_changed(self, func):
439446
"""
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
442449
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*)
444460
"""
445461
cid = self.cnt
446462
self.observers[cid] = func
447463
self.cnt += 1
448464
return cid
449465

450466
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+
"""
452475
try:
453476
del self.observers[cid]
454477
except KeyError:
455478
pass
456479

457480
def reset(self):
458-
"""reset the slider to the initial value if needed"""
481+
"""Reset the slider to the initial value"""
459482
if (self.val != self.valinit):
460483
self.set_val(self.valinit)
461484

0 commit comments

Comments
 (0)