Speeding up the Canvas Widget

Chris Barker Chris.Barker at noaa.gov
Mon Jun 3 13:30:29 EDT 2002


Salim Zayat wrote:
> I need to draw, and almost constantly redraw, upwards of like
> 10,000 or so things to the canvas (lines, text, and rectangles, etc.).
> The larger the number of things to be drawn, the slower it is.
There are apparently some tricks that can be used to speed some of thee
kinds of operations up. I'm not a TKuser, but there wasa a discusson
quite a while back (2 yrs?, I cna't find it in the archives, it may
predate them) on the wxPython newsgroup about drawing 10,000 rectangles,
and someone had found some tricks to make it go much faster with TK.

Since then, wxPython has added a couple of "Draw***List()" methods, that
draw a whole bunch of points or lines as a single Python call. It speeds
up the process of drawing losts of similar items considerably, by
putting the loop in C rather than Python. At the moment, only Points and
Lines are covered, but there is talk of adding all the draw objects,
someone just needs to get around to writing the code..(hint, hint)

I have no idea if pyGTK or pyQT support a call to draw lots of objects
with a single Python call, but that may be neccesary to get the speed
you want.

Chris

-- 
Christopher Barker, Ph.D.
Oceanographer
                                    		
NOAA/OR&R/HAZMAT         (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 Python-list mailing list