[pygtk] advice needed

Gabriel pygtk-user at gbeckers.nl
Tue Dec 19 19:52:59 WST 2006


I am in the process of converting from tkinter to pygtk, and I need  
advice on how to use a canvas for my application. I would be very  
grateful if somebody could help me out.

I have series of spectrograms (image representations of sound)  
available as 2-D numpy arrays. I want to show them on a canvas. What  
would be the most efficient way of doing this? An example would be  
greatly appreciated.

So far I managed to do this using a gnomecanvas. I convert the array,  
via a raw string, to a gtk.gdk.pixbuf, using  
gtk.gdk.pixbuf_new_from_data(). I create a gtk.Image object, and add  
the pixbuf with the set_from_pixbuf() method. The Image is then added  
to the gnomecanvas.Canvas with the add() method. But how do I set x  
and y? And is this the most efficient way?

Or should I use a gnomecanvas.CanvasPixbuf object instead of  
gtk.Image? But I can't find how to add my pixbuf to such an object.

Thanks in advance,


More information about the pygtk mailing list