[wxPython-users] Re: Improve performance
Robin Dunn
robin at alldunn.com
Mon Aug 28 23:23:43 PDT 2006
Christopher Barker wrote:
> Robin Dunn wrote:
>> You may want to take a look at my CVS commits for the last couple weeks.
>
> Our firewall has started blocking cvs and svn. While I argue with out
> sysadmins, I can't get it :-(
Daily CVS snapshots are at http://wxwidgets.org/snapshots/ (look under
"v1" of the site it redirects you to.) You can also browse the cvs
online at http://cvs.wxwidgets.org/viewcvs.cgi/wxWidgets/
> by the way, on of the points of the num* packages is that you don't have
> to loop to work with data in the array:
>
> >>> arr[:,:,R] = 0
> >>> arr[:,:,G] = 0
> >>> arr[:,:,B] = 255
> >>> alpha = numarray.arange(dim) * 255 / dim
> >>> arr[:,:,A] = alpha
>
> Much faster.
I knew there was something like that, but couldn't remember the syntax.
Thanks.
>
>> BTW, I seem to recall you mentioning that there was some doubt whether
>> the buffer protocol would be included in numpy, is that still true?
>
> I have no idea about the buffer protocol. I suppose now that there is
> the array interface, they might remove it, but it seems like a good idea
> to me to keep it. We'd have to ask on the numpy list. Or just test the
> latest numpy. Is there an easy way to test? OK, I just tested it with
> the latest numpy, and wx.ImageFromBuffer. Darn, it doesn't work. I get:
>
> File "/usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/_core.py",
> line 2814, in SetDataBuffer
> return _core_.Image_SetDataBuffer(*args, **kwargs)
> TypeError: non-character array cannot be interpreted as character buffer
>
>
> It might be that I am using the wring data type but I tried all the
> possible options I could think of. Code enclosed. It works with
> numarray, but not numpy. I'll post a question to the numpy list.
See my reply there.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list