@@ -1211,9 +1211,10 @@ def _on_timer(self):
12111211
12121212class Event :
12131213 """
1214- A Matplotlib event. Attach additional attributes as defined in
1215- :meth:`FigureCanvasBase.mpl_connect`. The following attributes
1216- are defined and shown with their default values
1214+ A Matplotlib event.
1215+
1216+ The following attributes are defined and shown with their default values.
1217+ Subclasses may define additional attributes.
12171218
12181219 Attributes
12191220 ----------
@@ -1232,20 +1233,20 @@ def __init__(self, name, canvas, guiEvent=None):
12321233
12331234class DrawEvent (Event ):
12341235 """
1235- An event triggered by a draw operation on the canvas
1236+ An event triggered by a draw operation on the canvas.
12361237
1237- In most backends callbacks subscribed to this callback will be
1238- fired after the rendering is complete but before the screen is
1239- updated. Any extra artists drawn to the canvas's renderer will
1240- be reflected without an explicit call to ``blit``.
1238+ In most backends, callbacks subscribed to this event will be fired after
1239+ the rendering is complete but before the screen is updated. Any extra
1240+ artists drawn to the canvas's renderer will be reflected without an
1241+ explicit call to ``blit``.
12411242
12421243 .. warning::
12431244
12441245 Calling ``canvas.draw`` and ``canvas.blit`` in these callbacks may
12451246 not be safe with all backends and may cause infinite recursion.
12461247
1247- In addition to the `Event` attributes, the following event
1248- attributes are defined:
1248+ A DrawEvent has a number of special attributes in addition to those defined
1249+ by the parent `Event` class.
12491250
12501251 Attributes
12511252 ----------
@@ -1259,10 +1260,10 @@ def __init__(self, name, canvas, renderer):
12591260
12601261class ResizeEvent (Event ):
12611262 """
1262- An event triggered by a canvas resize
1263+ An event triggered by a canvas resize.
12631264
1264- In addition to the `Event` attributes, the following event
1265- attributes are defined:
1265+ A ResizeEvent has a number of special attributes in addition to those
1266+ defined by the parent `Event` class.
12661267
12671268 Attributes
12681269 ----------
@@ -1284,32 +1285,23 @@ class LocationEvent(Event):
12841285 """
12851286 An event that has a screen location.
12861287
1287- The following additional attributes are defined and shown with
1288- their default values.
1289-
1290- In addition to the `Event` attributes, the following
1291- event attributes are defined:
1288+ A LocationEvent has a number of special attributes in addition to those
1289+ defined by the parent `Event` class.
12921290
12931291 Attributes
12941292 ----------
1295- x : int
1296- x position - pixels from left of canvas.
1297- y : int
1298- y position - pixels from bottom of canvas.
1293+ x, y : int or None
1294+ Event location in pixels from bottom left of canvas.
12991295 inaxes : `~.axes.Axes` or None
13001296 The `~.axes.Axes` instance over which the mouse is, if any.
1301- xdata : float or None
1302- x data coordinate of the mouse.
1303- ydata : float or None
1304- y data coordinate of the mouse.
1297+ xdata, ydata : float or None
1298+ Data coordinates of the mouse within *inaxes*, or *None* if the mouse
1299+ is not over an Axes.
13051300 """
13061301
13071302 lastevent = None # the last event that was triggered before this one
13081303
13091304 def __init__ (self , name , canvas , x , y , guiEvent = None ):
1310- """
1311- (*x*, *y*) in figure coords ((0, 0) = bottom left).
1312- """
13131305 super ().__init__ (name , canvas , guiEvent = guiEvent )
13141306 # x position - pixels from left of canvas
13151307 self .x = int (x ) if x is not None else x
@@ -1378,13 +1370,11 @@ class MouseButton(IntEnum):
13781370
13791371class MouseEvent (LocationEvent ):
13801372 """
1381- A mouse event ('button_press_event',
1382- 'button_release_event',
1383- 'scroll_event',
1384- 'motion_notify_event').
1373+ A mouse event ('button_press_event', 'button_release_event', \
1374+ 'scroll_event', 'motion_notify_event').
13851375
1386- In addition to the `Event` and `LocationEvent`
1387- attributes, the following attributes are defined:
1376+ A MouseEvent has a number of special attributes in addition to those
1377+ defined by the parent `Event` and `LocationEvent` classes.
13881378
13891379 Attributes
13901380 ----------
@@ -1426,10 +1416,6 @@ def on_press(event):
14261416
14271417 def __init__ (self , name , canvas , x , y , button = None , key = None ,
14281418 step = 0 , dblclick = False , guiEvent = None ):
1429- """
1430- (*x*, *y*) in figure coords ((0, 0) = bottom left)
1431- button pressed None, 1, 2, 3, 'up', 'down'
1432- """
14331419 if button in MouseButton .__members__ .values ():
14341420 button = MouseButton (button )
14351421 self .button = button
@@ -1450,11 +1436,14 @@ def __str__(self):
14501436
14511437class PickEvent (Event ):
14521438 """
1453- A pick event, fired when the user picks a location on the canvas
1439+ A pick event.
1440+
1441+ This event is fired when the user picks a location on the canvas
14541442 sufficiently close to an artist that has been made pickable with
14551443 `.Artist.set_picker`.
14561444
1457- Attrs: all the `Event` attributes plus
1445+ A PickEvent has a number of special attributes in addition to those defined
1446+ by the parent `Event` class.
14581447
14591448 Attributes
14601449 ----------
@@ -1495,19 +1484,16 @@ class KeyEvent(LocationEvent):
14951484 """
14961485 A key event (key press, key release).
14971486
1498- Attach additional attributes as defined in
1499- :meth:`FigureCanvasBase.mpl_connect`.
1500-
1501- In addition to the `Event` and `LocationEvent`
1502- attributes, the following attributes are defined:
1487+ A KeyEvent has a number of special attributes in addition to those defined
1488+ by the parent `Event` and `LocationEvent` classes.
15031489
15041490 Attributes
15051491 ----------
15061492 key : None or str
1507- the key(s) pressed. Could be ** None** , a single case sensitive ascii
1508- character ("g", "G", "#", etc.), a special key
1509- ("control", "shift", " f1", "up", etc.) or a
1510- combination of the above (e.g., "ctrl+alt+g", "ctrl+alt+G").
1493+ The key(s) pressed. Could be *None*, a single case sensitive Unicode
1494+ character ("g", "G", "#", etc.), a special key ("control", "shift",
1495+ " f1", "up", etc.) or a combination of the above (e.g., "ctrl+alt+g",
1496+ "ctrl+alt+G").
15111497
15121498 Notes
15131499 -----
0 commit comments