gtk* bug

I think we have a problem in GTK. In the script below, if you add a
button or some other widget above the figure canvas, only a part of
the canvas is updated in the motion_notify_event update. The distance
from the top of the figure canvas to the part that is not updated is
equal to the height of the widget packed above the canvas. You can
observe this by resizing the window to make it taller or shorter and
noting the vertical extent where the horizontal line disappears.

In the example below, when you move your mouse over the canvas, the
sine wave update will affect only part of the sine, and the horizontal
line will only update below this mystery boundary.

If you comment out the line that packs in the button, the script will
behave correctly.

Perhaps we are screwing up the pixmap management.

I initially thought this was a problem with gtkagg, but on further
examination I found it applies to plain-vanilla-gtk as well as gtkagg.

Any ideas?

#!/usr/bin/env python
show how to add a matplotlib FigureCanvasGTK or FigureCanvasGTKAgg widget and
a toolbar to a gtk.Window
from matplotlib.figure import Figure
from matplotlib.numerix import arange, sin, pi

#from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas
from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas

import gtk

win = gtk.Window()
win.connect("destroy", lambda x: gtk.main_quit())
win.set_title("Embedding in GTK")

vbox = gtk.VBox()

fig = Figure(dpi=100)
ax = fig.add_subplot(111, autoscale_on=False)
t = arange(0.0,3.0,0.01)
s = sin(2*pi*t)

sline, = ax.plot(t,s)

line, = ax.plot([0,3], [0,0], color='red', linewidth=2)

if 1: # if button is visible bug is exposed
    button = gtk.Button('Hi mom')
    vbox.pack_start(button, True, True)

canvas = FigureCanvas(fig) # a gtk.DrawingArea
vbox.pack_start(canvas, True, True)

def update(event):
    if not event.inaxes: return
    print event.ydata
    line.set_ydata((event.ydata, event.ydata))
    return False

canvas.mpl_connect('motion_notify_event', update)