[wxPython-users] Re: dilemma, plot or scope or ...

Christopher Barker Chris.Barker at noaa.gov
Tue Oct 16 09:55:21 PDT 2007


jmf wrote:
> For example, by using "native" Python types like integers instead of
> tuples or lists or wx.Point's,

A agree about wx.Points, but how in the world do you avoid some sort of 
container?

Do you use numpy? It should help. However, at this point, wxPython does 
not "understand" numpy arrays. If you pass them directly to methods like 
DC.DrawLines(), it parses them as a generic sequence, which is slower 
than it needs to be. There are some optimizations for lists of (x,y) 
tuples, but, this being python, there is still a lot of overhead.

It would not be too hard to write an extension to the wxPython 
"PointListHelper" that understood the numpy array interface, and might 
even be able to pass in a pointer to the block of data directly to the 
Draw** function, eliminated almost all the overhead. However, maybe it 
takes longer to draw than to parse the data anyway. It certainly does 
with more complex drawing like polygons, etc.

-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