matplotlib/matplotlib · error · RuntimeError
Another Axes already grabs mouse input
Error message
Another Axes already grabs mouse input
What it means
Error "Another Axes already grabs mouse input" thrown in matplotlib/matplotlib.
Source
Thrown at lib/matplotlib/backend_bases.py:1933
"""
axes_list = [a for a in self.figure.get_axes()
if a.patch.contains_point(xy) and a.get_visible()]
if axes_list:
axes = cbook._topmost_artist(axes_list)
else:
axes = None
return axes
def grab_mouse(self, ax):
"""
Set the child `~.axes.Axes` which is grabbing the mouse events.
Usually called by the widgets themselves. It is an error to call this
if the mouse is already grabbed by another Axes.
"""
if self.mouse_grabber not in (None, ax):
raise RuntimeError("Another Axes already grabs mouse input")
self.mouse_grabber = ax
def release_mouse(self, ax):
"""
Release the mouse grab held by the `~.axes.Axes` *ax*.
Usually called by the widgets. It is ok to call this even if *ax*
doesn't have the mouse grab currently.
"""
if self.mouse_grabber is ax:
self.mouse_grabber = None
def set_cursor(self, cursor):
"""
Set the current cursor.
This may have no effect if the backend does not display anything.
View on GitHub (pinned to b379c1b69e)
When it happens
Trigger: Thrown at lib/matplotlib/backend_bases.py:1933 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of matplotlib/matplotlib@b379c1b69e (2026-08-21).
Data as JSON: /api/errors/057e8d9c7010d6eb.
Report an issue: GitHub.