Commit 43044d9
committed
Fix (uncatchable) traceback in GTK4 embedding example
On startup, GTK4 appears to call `draw` earlier, which causes an
uncatchable traceback:
```
Traceback (most recent call last):
File "lib/matplotlib/backends/backend_gtk4.py", line 203, in _draw_func
self.on_draw_event(self, ctx)
File "lib/matplotlib/backends/backend_gtk4agg.py", line 30, in on_draw_event
np.asarray(self.renderer.buffer_rgba()))
AttributeError: 'FigureCanvasGTK4Agg' object has no attribute 'renderer'
```
Since a real draw happens later, we just need to be sure a renderer
exists at this time.1 parent 3bcc18a commit 43044d9
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
0 commit comments