|
100 | 100 | import matplotlib.backend_bases
|
101 | 101 | from matplotlib.axis import Tick
|
102 | 102 | from matplotlib.axes._base import _AxesBase
|
103 |
| - from matplotlib.backend_bases import Event |
| 103 | + from matplotlib.backend_bases import ( |
| 104 | + CloseEvent, |
| 105 | + DrawEvent, |
| 106 | + KeyEvent, |
| 107 | + MouseEvent, |
| 108 | + PickEvent, |
| 109 | + ResizeEvent, |
| 110 | + ) |
104 | 111 | from matplotlib.cm import ScalarMappable
|
105 | 112 | from matplotlib.contour import ContourSet, QuadContourSet
|
106 | 113 | from matplotlib.collections import (
|
|
126 | 133 | from matplotlib.quiver import Barbs, Quiver, QuiverKey
|
127 | 134 | from matplotlib.scale import ScaleBase
|
128 | 135 | from matplotlib.typing import (
|
| 136 | + CloseEventType, |
129 | 137 | ColorType,
|
130 | 138 | CoordsType,
|
| 139 | + DrawEventType, |
131 | 140 | HashableList,
|
| 141 | + KeyEventType, |
132 | 142 | LineStyleType,
|
133 | 143 | MarkerType,
|
134 |
| - EventType |
| 144 | + MouseEventType, |
| 145 | + PickEventType, |
| 146 | + ResizeEventType, |
135 | 147 | )
|
136 | 148 | from matplotlib.widgets import SubplotTool
|
137 | 149 |
|
@@ -1176,8 +1188,32 @@ def get_current_fig_manager() -> FigureManagerBase | None:
|
1176 | 1188 | return gcf().canvas.manager
|
1177 | 1189 |
|
1178 | 1190 |
|
| 1191 | +@overload |
| 1192 | +def connect(s: MouseEventType, func: Callable[[MouseEvent], Any]) -> int: ... |
| 1193 | + |
| 1194 | + |
| 1195 | +@overload |
| 1196 | +def connect(s: KeyEventType, func: Callable[[KeyEvent], Any]) -> int: ... |
| 1197 | + |
| 1198 | + |
| 1199 | +@overload |
| 1200 | +def connect(s: PickEventType, func: Callable[[PickEvent], Any]) -> int: ... |
| 1201 | + |
| 1202 | + |
| 1203 | +@overload |
| 1204 | +def connect(s: ResizeEventType, func: Callable[[ResizeEvent], Any]) -> int: ... |
| 1205 | + |
| 1206 | + |
| 1207 | +@overload |
| 1208 | +def connect(s: CloseEventType, func: Callable[[CloseEvent], Any]) -> int: ... |
| 1209 | + |
| 1210 | + |
| 1211 | +@overload |
| 1212 | +def connect(s: DrawEventType, func: Callable[[DrawEvent], Any]) -> int: ... |
| 1213 | + |
| 1214 | + |
1179 | 1215 | @_copy_docstring_and_deprecators(FigureCanvasBase.mpl_connect)
|
1180 |
| -def connect(s: EventType, func: Callable[[Event], Any]) -> int: |
| 1216 | +def connect(s, func) -> int: |
1181 | 1217 | return gcf().canvas.mpl_connect(s, func)
|
1182 | 1218 |
|
1183 | 1219 |
|
|
0 commit comments