[wxPython-users] Creating Custom wxPython Widget

Christopher Barker Chris.Barker at noaa.gov
Mon Dec 11 11:19:52 PST 2006


Robin Dunn wrote:
> If you don't want the additional dependency of NumPy I think you 
> can do the same with the standard array module.

indeed,you could  use any object that support the Buffer interface:

http://python.active-venture.com/api/bufferObjects.html

 >  Although it is a very
> rich tool so if you use it you can probably also do any other 
> manipulation of the data that you need to do, with all the heavy lifting 
> being quickly done in the extension module.

exactly. The odds are very good that if you're graphing data, you can 
use numpy for lots of other stuff.

Maybe sure to check out matplotlib too -- it many not meet your 
performance requirements, but it is a very nice package, and works well 
embedded in wxPython.

A plug: at this point, the wxPython has code to optimize reading in a 
list of 2-tuples of numbers for input into things like:

wx.DC.DrawLines()

when you pass in a numpy array, it uses the generic sequence indexing to 
get the data -- this is a bit slow, as numpy then has to generate a 
bunch of little arrays to hold each point, then index those to get the 
numbers, etc.

It would be great if wxPython understood the numpy "array interface", 
(http://numpy.scipy.org/array_interface.shtml) so that methods like 
DrawLines could access the numpy data array directly. This would require 
some additions to the PointListHelper code in wxPython.

It's on my list to do it some day, but a lot of things are on my list...

-Chris















-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the wxpython-users mailing list