Skip to content

[Bug]: TextBox widget raises AttributeError on ResizeEvent #32222

Description

@KevoSoftworks

Bug summary

When an interactive window contains a TextBox widget, the creation and resizing of said window will throw an AttributeError on widgets.py#L184 for event.inaxes.

Code for reproduction

import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.use("qt5agg")
fig, ax = plt.subplots(1, 1)
mpl.widgets.TextBox(ax, "Text box")
plt.show()

Actual outcome

The window is rendered and outputs the following:

Traceback (most recent call last):
  File "/home/kevin/.asdf/installs/python/3.14.7/lib/python3.14/site-packages/matplotlib/cbook.py", line 390, in process
    func(*args, **kwargs)
    ~~~~^^^^^^^^^^^^^^^^^
  File "/home/kevin/.asdf/installs/python/3.14.7/lib/python3.14/site-packages/matplotlib/widgets.py", line 184, in wrapper
    if event.inaxes is not self.ax:
       ^^^^^^^^^^^^
AttributeError: 'ResizeEvent' object has no attribute 'inaxes'

See the image below where the plot window was created (resulting in two exceptions) and switched from a full-screen to a floating window (resulting in one exception)

Image

Expected outcome

The window is rendered without raising the AttributeError

Additional information

I'm running Fedora 44 using Sway. Under Python 3.10.5 with an unknown version of matplotlib (installed in 2023, unknown in updated in the meantime), this problem was not present. An update to the latest Python 3.14.7 and matplotlib 3.11.1 yields this issue.

Operating system

Fedora 44

Matplotlib Version

3.11.1

Matplotlib Backend

qt5agg

Python version

3.14.7

Jupyter version

No response

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions