Skip to content

Any resizing of the plot after plt.show results in an error when closing the window #24395

@ameligrana

Description

@ameligrana

Bug summary

After plt.show(), clicking on configure subplots and changing any parameter results in an error after closing the window.

Code for reproduction

import matplotlib.pyplot as plt
plt.plot([0,1],[0,1])
plt.show()
# after that, click on configure subplots and change any parameter, then close

Actual outcome

Traceback (most recent call last):
File "C:\Users\Bob\AppData\Local\Programs\Python\Python310\lib\site-packages\matplotlib\cbook_init_.py", line 307, in process
func(*args, **kwargs)
File "C:\Users\Bob\AppData\Local\Programs\Python\Python310\lib\site-packages\matplotlib\backend_bases.py", line 3290, in
"close_event", lambda e: manager.destroy())
File "C:\Users\Bob\AppData\Local\Programs\Python\Python310\lib\site-packages\matplotlib\backends_backend_tk.py", line 529, in destroy
self._window_dpi.trace_remove('write', self.window_dpi_cbname)
File "C:\Users\Bob\AppData\Local\Programs\Python\Python310\lib\tkinter_init
.py", line 455, in trace_remove
self._tk.deletecommand(cbname)
_tkinter.TclError: can't delete Tcl command

Expected outcome

Close without error

Additional information

No response

Operating system

Windows 10

Matplotlib Version

matplotlib-3.6.2

Matplotlib Backend

No response

Python version

3.10

Jupyter version

No response

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions