Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5c95197

Browse filesBrowse files
committed
Convert slider docstrings to numpydoc
1 parent 201d536 commit 5c95197
Copy full SHA for 5c95197

File tree

Expand file treeCollapse file tree

1 file changed

+28
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+28
-5
lines changed

‎lib/matplotlib/widgets.py

Copy file name to clipboardExpand all lines: lib/matplotlib/widgets.py
+28-5Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.