Bug in matplotlib_gtk ?


I'm using matplotlib figures in several places at a

time in my GTK based app (means different page in a notebook).
I have trace a bug I partially solved but still doubting if it is a matplotlib bug or a bad design of my app.

Matplotlib 0.86.2

Here is the problem:

in matplotlib/backends/backend_gtk.py file, in
class FigureCanvasGTK (gtk.DrawingArea, FigureCanvasBase):
… in:

def draw(self):
# synchronous window redraw (like GTK+ 1.2 used to do)
# Note: this does not follow the usual way that GTK redraws,
# which is asynchronous redraw using calls to gtk_widget_queue_draw(),
# which triggers an expose-event

    # GTK+ 2.x style draw()

1- self._need_redraw = True
1- self.queue_draw()

    # synchronous draw (needed for animation)

2- x, y, w, h = self.allocation
2- if w<3 or h<3: return # empty fig

2- self._pixmap_prepare (w, h)
2- self._render_figure(self._pixmap, w, h)
2- self._need_redraw = False
2- self.window.draw_drawable (self.style.fg_gc[self.state],

self._pixmap, 0, 0, 0, 0, w, h)

If I use method 1- (and comment 2-) no problem, all run smoothly…
But using the default method, switching on method 2- (and comment 1-)
I get the followig error message when trying to redraw one of the figure
(the figure is plotted correctly the first time. No change made to the figure, just redrawing…)

GtkWarning: gdk_pixmap_new: assertion `(drawable != NULL) || (depth !=
-1)’ failed
Traceback (most recent call last):

File “***/python2.4/site-packages/matplotlib/backends/backend_gtk.py”, line 250, in draw
self._pixmap_prepare (w, h)
File “***/python2.4/site-packages/matplotlib/backends/backend_gtk.py”, line 298, in _pixmap_prepare
RuntimeError: could not create GdkPixmap object

Somebody has a clue ???