8000 DOC: add docs warning about triggering recursions in draw_event · matplotlib/matplotlib@6789aed · GitHub
[go: up one dir, main page]

Skip to content

Commit 6789aed

Browse files
committed
DOC: add docs warning about triggering recursions in draw_event
1 parent 39daead commit 6789aed

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

doc/users/event_handling.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ Here are the events that you can connect to, the class instances that
5757
are sent back to you when the event occurs, and the event descriptions
5858

5959

60-
======================= ======================================================================================
60+
======================= =============================================================================================
6161
Event name Class and description
62-
======================= ======================================================================================
62+
======================= =============================================================================================
6363
'button_press_event' :class:`~matplotlib.backend_bases.MouseEvent` - mouse button is pressed
6464
'button_release_event' :class:`~matplotlib.backend_bases.MouseEvent` - mouse button is released
65-
'draw_event' :class:`~matplotlib.backend_bases.DrawEvent` - canvas draw
65+
'draw_event' :class:`~matplotlib.backend_bases.DrawEvent` - canvas draw (but before screen update)
6666
'key_press_event' :class:`~matplotlib.backend_bases.KeyEvent` - key is pressed
6767
'key_release_event' :class:`~matplotlib.backend_bases.KeyEvent` - key is released
6868
'motion_notify_event' :class:`~matplotlib.backend_bases.MouseEvent` - mouse motion
@@ -73,7 +73,7 @@ Event name Class and description
7373
'figure_leave_event' :class:`~matplotlib.backend_bases.LocationEvent` - mouse leaves a figure
7474
'axes_enter_event' :class:`~matplotlib.backend_bases.LocationEvent` - mouse enters a new axes
7575
'axes_leave_event' :class:`~matplotlib.backend_bases.LocationEvent` - mouse leaves an axes
76-
======================= ======================================================================================
76+
======================= =============================================================================================
7777

7878
.. _event-attributes:
7979

lib/matplotlib/backend_bases.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,6 +1428,17 @@ class DrawEvent(Event):
14281428
In addition to the :class:`Event` attributes, the following event
14291429
attributes are defined:
14301430
1431+
1432+
In most backends callbacks subscribed to this callback will be
1433+
fired after the rendering is complete but before the screen is
1434+
updated. Any extra artists drawn to the canvas's renderer will
1435+
be reflected without an explicit call to ``blit``.
1436+
1437+
.. warning ::
1438+
1439+
Calling ``canvas.draw`` and ``canvas.blit`` in these callbacks may
1440+
not be safe with all backends and may cause infinite recursion.
1441+
14311442
Attributes
14321443
----------
14331444
renderer : `RendererBase`

0 commit comments

Comments
 (0)
0