Closed
Description
Bug report
Bug summary
Calling plt.pause
inside a callback crashes the GTK3Agg backend.
Code for reproduction
import matplotlib as mpl
mpl.use('GTK3Agg')
import matplotlib.pyplot as plt
def do_nothing(event):
print('In callback.')
plt.pause(1)
fig = plt.figure()
fig.canvas.mpl_connect('resize_event', do_nothing)
ax = fig.add_subplot()
ax.plot(0, 0, 'o')
plt.show()
Actual outcome
In callback.
**
Gtk:ERROR:../../../../gtk/gtkwindow.c:10698:gtk_window_present_with_time: assertion failed: (gdk_window != NULL)
Bail out! Gtk:ERROR:../../../../gtk/gtkwindow.c:10698:gtk_window_present_with_time: assertion failed: (gdk_window != NULL)
Aborted (core dumped)
Expected outcome
The graph should be plotted. No crashes should occur.
Matplotlib version
- Operating system: Linux Mint 20 (Ulyana)
- Matplotlib version: 3.3.3 (installed via
pip install matplotlib
) - Matplotlib backend: GTK3Agg
- Python version: 3.8.5
- GTK version: 3.0
More Details
The problem disappears upon doing either of the following.
- Using the TkAgg backend.
- Removing the line
plt.pause(1)
.