I would like to put a gtk.Button on top of a FigureCanvas. But whatever
I try the FigureCanvas stays always on top hiding the button.

Below is an example where I can change the order of buttons
by switching the following two lines

   lay.put(but1,360,260)
   lay.put(but2,360,275)

but this doesn't work for FigureCanvas

  lay.put(canvas,0,0)

Any help appreciated.

Ciao
Andreas




import gtk
import numpy as np
import pylab as mpl
from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as 
FigureCanvas

win = gtk.Window()
win.set_default_size(450,350)

fig = mpl.figure()
subfig = fig.add_subplot(1,1,1)
ax = subfig.plot([2,3,1])
canvas = FigureCanvas(fig)
canvas.set_size_request(400,300)

but1 = gtk.Button('111111111')
but2 = gtk.Button('222222222')

lay = gtk.Layout()
lay.put(canvas,0,0)
lay.put(but1,360,260)
lay.put(but2,360,275)

win.add(lay)
win.show_all()
win.connect('destroy', gtk.main_quit)
gtk.main()


------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to