On 07/13/2010 02:31 AM, John Hunter wrote:
On Mon, Jul 12, 2010 at 8:05 PM, John Hunter<jdh2...@gmail.com> wrote:
All of which is discouraging: we both see bugs but different ones on
linux, the appearance of the bug is caused by adding a combobox which
is not used (on my system), the bug appears on some platforms (linux)
but not others (win) and it appears for both gtk and gtkagg.
The last thing I'll add for now is that my bug, the black pixel noise
(fills the axes window when motion starts in a zoom-to-rect event)
which may be unrelated to your bug, is happening in
backend_gtk.NavigationToolbar2GTK.draw_rubberband in the pair of
calls:
# this is used to copy the background that the zoom to rect
"rubberband" will be drawn over
self._imageBack = axrect, drawable.get_image(*axrect)
# this is used to restore the background before redrawing the
rectangle for the zoom box
drawable.draw_image(gc, imageBack, 0, 0, *lastrect)
Since the bug is only exposed when a combo box is added to the
hierarchy, and appears to be platform or gtk specific, I'm suspecting
a gtk bug at this point. But I don't have anything conclusive or a
minimal example which I could use to post to the gtk list. The mpl
calls and values (axrect, lastrect, etc) look correct on inspection.
Somehow the call to drawable.get_image is getting a buffer full of
noise if and only if the combobox is added to the vbox.
JDH
From what I could understand from the pygtk documentation get_image /
draw_image are client-side operations. In particular:
"If the source drawable is a Gdk::Window and partially offscreen or
obscured, then the obscured portions of the returned image will contain
undefined data."
Anyway they recommend using Pixmap, which is server-side and a offscreen
drawable. I've attached a patch that replaces the get_image / draw_image
with Pixmap operations and fixes this bug. I've tested this patch on
Linux and Windows.
Regards,
João Luís
Index: lib/matplotlib/backends/backend_gtk.py
===================================================================
--- lib/matplotlib/backends/backend_gtk.py (revision 8572)
+++ lib/matplotlib/backends/backend_gtk.py (working copy)
@@ -616,7 +616,7 @@
self.canvas.window.set_cursor(cursord[cursor])
def release(self, event):
- try: del self._imageBack
+ try: del self._pixmapBack
except AttributeError: pass
def dynamic_update(self):
@@ -640,7 +640,7 @@
rect = [int(val)for val in min(x0,x1), min(y0, y1), w, h]
try:
- lastrect, imageBack = self._imageBack
+ lastrect, pixmapBack = self._pixmapBack
except AttributeError:
#snap image back
if event.inaxes is None:
@@ -650,9 +650,10 @@
l,b,w,h = [int(val) for val in ax.bbox.bounds]
b = int(height)-(b+h)
axrect = l,b,w,h
- self._imageBack = axrect, drawable.get_image(*axrect)
+ self._pixmapBack = axrect, gtk.gdk.Pixmap(drawable, w, h)
+ self._pixmapBack[1].draw_drawable(gc, drawable, l, b, 0, 0, w, h)
else:
- drawable.draw_image(gc, imageBack, 0, 0, *lastrect)
+ drawable.draw_drawable(gc, pixmapBack, 0, 0, *lastrect)
drawable.draw_rectangle(gc, False, *rect)
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users