Gabriel wrote:
Thanks; yes I use matplotlib for a lot of other things. But in this
case I am not sure it is the best way to go. I have a huge pytables
repository of relatively small and already calculated spectrograms
(say 128x30 pixels) that I need to display, page after page. One
screen can contain hundreds of them, so they need to be loaded
relatively fast.
The thing is that I am new to pygtk (and gnome) and after reading
various posts and articles, I am a bit confused about what the most
straightforward way is to display many relatively small bitmaps on a
canvas.
All best, Gabriel
I'm using the CanvasPixbuf to display Numeric array data; I've only
tried it for smaller numbers of images (~ 25), so I don't know how
well it will perform for larger counts. A CanvasPixbuf will scale
with the rest of the canvas when using .set_pixels_per_unit(), so this
makes zooming convenient.
The relevant snippet follows; `canvas` is the gnome canvas module.
Good luck,
Michael
import Numeric as N
pix_arr = N.array(t4, 'b')
#
#*** Get the pixbuf.
# array input indexing is row, pixel, [r,g,b {,a} ]
pixbuf = gtk.gdk.pixbuf_new_from_array(pix_arr,
gtk.gdk.COLORSPACE_RGB, 8)
#
#*** display pixbuf as item
d_canv = < your canvas here >
d_rt = d_canv.root().add(canvas.CanvasGroup)
d_rt.add(canvas.CanvasPixbuf,
x = 20, # world units
y = 20,
height_set = True,
width_set = True,
width = 15, # world units
height = 15,
pixbuf = pixbuf,
)
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/