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

Skip to content

Commit 1a92dc9

Browse files
authored
Merge pull request #30939 from timhoffm/doc-widget-inheritance
DOC: Improve widgets API documentation
2 parents a0c93f1 + def8e73 commit 1a92dc9

2 files changed

Lines changed: 67 additions & 13 deletions

File tree

doc/api/widgets_api.rst

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,53 @@
22
``matplotlib.widgets``
33
**********************
44

5-
.. inheritance-diagram:: matplotlib.widgets
5+
.. currentmodule:: matplotlib.widgets
6+
7+
.. automodule:: matplotlib.widgets
8+
:no-members:
9+
:no-undoc-members:
10+
11+
12+
Widget classes
13+
==============
14+
15+
.. inheritance-diagram:: matplotlib.widgets.Widget
616
:parts: 1
17+
:private-bases:
18+
:include-subclasses:
719

20+
.. autosummary::
21+
:toctree: _as_gen
22+
:template: autosummary.rst
23+
:nosignatures:
824

9-
.. automodule:: matplotlib.widgets
10-
:members:
11-
:undoc-members:
12-
:show-inheritance:
25+
Widget
26+
AxesWidget
27+
Cursor
28+
MultiCursor
29+
Button
30+
CheckButtons
31+
RadioButtons
32+
SliderBase
33+
Slider
34+
RangeSlider
35+
TextBox
36+
_SelectorWidget
37+
RectangleSelector
38+
EllipseSelector
39+
Lasso
40+
LassoSelector
41+
PolygonSelector
42+
SpanSelector
43+
SubplotTool
44+
45+
Helper classes
46+
==============
47+
48+
.. autosummary::
49+
:toctree: _as_gen
50+
:nosignatures:
51+
52+
LockDraw
53+
ToolHandles
54+
ToolLineHandles

lib/matplotlib/widgets.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
"""
2-
GUI neutral widgets
3-
===================
4-
52
Widgets that are designed to work for any of the GUI backends.
3+
64
All of these widgets require you to predefine an `~.axes.Axes`
75
instance and pass that as the first parameter. Matplotlib doesn't try to
86
be too smart with respect to layout -- you will have to figure out how
@@ -2202,6 +2200,16 @@ def onmove(self, event):
22022200

22032201

22042202
class _SelectorWidget(AxesWidget):
2203+
"""
2204+
The base class for selector widgets.
2205+
2206+
This class provides common functionality for selector widgets,
2207+
such as handling mouse and keyboard events, managing state modifier keys, etc.
2208+
2209+
The class itself is private and may be changed or removed without prior warning.
2210+
However, the public API it provides to subclasses is stable and considered
2211+
public on the subclasses.
2212+
"""
22052213

22062214
def __init__(self, ax, onselect=None, useblit=False, button=None,
22072215
state_modifier_keys=None, use_data_coordinates=False):
@@ -2506,7 +2514,7 @@ def set_props(self, **props):
25062514
def set_handle_props(self, **handle_props):
25072515
"""
25082516
Set the properties of the handles selector artist. See the
2509-
`handle_props` argument in the selector docstring to know which
2517+
*handle_props* argument in the selector docstring to know which
25102518
properties are supported.
25112519
"""
25122520
if not hasattr(self, '_handles_artists'):
@@ -2530,13 +2538,15 @@ def _validate_state(self, state):
25302538
def add_state(self, state):
25312539
"""
25322540
Add a state to define the widget's behavior. See the
2533-
`state_modifier_keys` parameters for details.
2541+
*state_modifier_keys* parameter in the constructor of the concrete
2542+
selector class for details.
25342543
25352544
Parameters
25362545
----------
25372546
state : str
25382547
Must be a supported state of the selector. See the
2539-
`state_modifier_keys` parameters for details.
2548+
*state_modifier_keys* parameter in the constructor of the concrete
2549+
selector class for details.
25402550
25412551
Raises
25422552
------
@@ -2550,13 +2560,15 @@ def add_state(self, state):
25502560
def remove_state(self, state):
25512561
"""
25522562
Remove a state to define the widget's behavior. See the
2553-
`state_modifier_keys` parameters for details.
2563+
*state_modifier_keys* parameter in the constructor of the concrete
2564+
selector class for details.
25542565
25552566
Parameters
25562567
----------
25572568
state : str
25582569
Must be a supported state of the selector. See the
2559-
`state_modifier_keys` parameters for details.
2570+
*state_modifier_keys* parameter in the constructor of the concrete
2571+
selector class for details.
25602572
25612573
Raises
25622574
------

0 commit comments

Comments
 (0)