From 23a0b3d80b4b6ad16654c3e4c6e4f77868ba1a5c Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Mon, 23 Mar 2020 21:14:51 +0100 Subject: [PATCH] Warn in the docs that MouseEvent.key can be wrong. --- lib/matplotlib/backend_bases.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index 1b6891545f2e..9c4416a5610e 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -1369,6 +1369,12 @@ class MouseEvent(LocationEvent): The key pressed when the mouse event triggered, e.g. 'shift'. See `KeyEvent`. + .. warning:: + This key is currently obtained from the last 'key_press_event' or + 'key_release_event' that occurred within the canvas. Thus, if the + last change of keyboard state occurred while the canvas did not have + focus, this attribute will be wrong. + step : int The number of scroll steps (positive for 'up', negative for 'down'). This applies only to 'scroll_event' and defaults to 0 otherwise.