@@ -19,7 +19,7 @@ from matplotlib.text import Text
19
19
from matplotlib .transforms import Bbox ,BboxBase ,Transform ,TransformedPath
20
20
21
21
from collections .abc import Callable ,Iterable ,Sequence
22
- from typing import Any ,IO ,Literal ,NamedTuple ,TypeVar
22
+ from typing import Any ,IO ,Literal ,NamedTuple ,TypeVar , overload
23
23
from numpy .typing import ArrayLike
24
24
from .typing import ColorType ,LineStyleType ,CapStyleType ,JoinStyleType
25
25
@@ -352,6 +352,40 @@ class FigureCanvasBase:
352
352
def get_default_filetype (cls )-> str : ...
353
353
def get_default_filename (self )-> str : ...
354
354
_T = TypeVar ("_T" ,bound = FigureCanvasBase )
355
+
356
+ @overload
357
+ def mpl_connect (
358
+ self ,
359
+ s :Literal [
360
+ "button_press_event" ,
361
+ "motion_notify_event" ,
362
+ "scroll_event" ,
363
+ "figure_enter_event" ,
364
+ "figure_leave_event" ,
365
+ "axes_enter_event" ,
366
+ "axes_leave_event" ,
367
+ "button_release_event" ,
368
+ ],
369
+ func :Callable [[MouseEvent ],Any ],
370
+ )-> int : ...
371
+
372
+ @overload
373
+ def mpl_connect (
374
+ self ,
375
+ s :Literal ["key_press_event" ,"key_release_event" ],
376
+ func :Callable [[KeyEvent ],Any ],
377
+ )-> int : ...
378
+
379
+ @overload
380
+ def mpl_connect (self ,s :Literal ["pick_event" ],func :Callable [[PickEvent ],Any ])-> int : ...
381
+
382
+ @overload
383
+ def mpl_connect (self ,s :Literal ["resize_event" ],func :Callable [[ResizeEvent ],Any ])-> int : ...
384
+
385
+ @overload
386
+ def mpl_connect (self ,s :Literal ["close_event" ],func :Callable [[CloseEvent ],Any ])-> int : ...
387
+
388
+ @overload
355
389
def mpl_connect (self ,s :str ,func :Callable [[Event ],Any ])-> int : ...
356
390
def mpl_disconnect (self ,cid :int )-> None : ...
357
391
def new_timer (