Thanks, I'm currently using gtk.gdk.pixbuf_new_from_data() after converting the 
numpy array using to_string. Unfortunately I'm updating 
largegtk.gdk.pixbuf_new_from_array would overcome this bottleneck. I'll try 
using struct.pack_into(..) and see if this is faster?

Craig

On 21 Feb 2010, at 8:53am, Osmo Maatta wrote:

> Hello,
> 
> Maybe you can use the gtk.gdk.pixbuf_new_from_data() function instead.
> 
> Take a look at this module (som functions I prototyped for my Gscreendump 
> program).
> http://www.futuredesktop.com/tmp/switch_desktop.py
> Look for  "get_window_icon_image" function.
> 
> Use struct.pack_into(...) to pack the data appropriately into a byte array.
> 
> Ref: http://docs.python.org/dev/3.0/library/struct.html
> struct.pack_into("=BBBB", bytearr,  offset, b1, b2, b3, b4)
> 
> then call
> pixbuf  = gtk.gdk.pixbuf_new_from_data(bytearr,  gtk.gdk.COLORSPACE_RGB, 
> True, 8, icon_width, icon_height, icon_width * 4) 
> 
> // Moma Antero
> 
> 
> Craig Warren wrote:
>> Hi folks,
>> 
>> I'm trying to use gtk.gdk.pixbuf_new_from_array to make a pixbuf from a 
>> numpy array and getting a runtime error "pygtk was not compiled with Numeric 
>> Python support". I used the following to install pygtk and numpy:
>> 
>> pygtk-2.16.0+glade.win32-py2.6
>> numpy-1.3.0-win32-superpack-python2.6
>> 
>> Is pygtk-2.16.0 compiled with numpy? Why does the error refer to Numeric 
>> Python, I thought this was deprecated?
>> 
>> I'd like not to have to install MinGW etc and have to compile pygtk myself. 
>> Any suggestions?
>> 
>> Thanks.
>> 
>> Craig
>>   
>> 
> 


-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to