wxPython: wxDC problem

Vadim Zeitlin zeitlin at seth.lpthe.jussieu.fr
Tue Apr 23 12:51:29 EDT 2002


On 23 Apr 2002 08:21:29 -0700, Carole Valentin <carole at autosim.no> wrote:
> I have a road map drawn in a wxDC and some cars in the same wxDC.

 I assume that this is a wxPaintDC or wxClientDC, i.e. its contents is drawn
on some window, isn't it?

> When the cars are moving, I would like to redraw only them and not the
> entire map.

 Simple Refresh() only the region of the window encompassing the old and new
car positions (alternatively you could call Refresh() twice for the old and
the new location but I'm not sure it is really more efficient). And, of
course, in your redrawing logic you should only update the objects
intersecting the update region of the window.

> Does the wxDC::SetClippingRegion method create an independant wxDC?

 No, it doesn't, but this is besides the point: wxWindows clips any redrawing
you do to the update region anyhow, so you just have to avoid refreshing too
much. Redrawing the unaffected objects doesn't hurt as much (i.e. at least it
wouldn't result in horrible flicker unlike refreshing the entire window each
time the car moves) but it's a good to avoid doing it nevertheless.

 Regards,
VZ
-- 
GCS/GM d? H+ s++:-- p2 au--- a- w+ v C+++ UBLS+++ P- L++ N++ E--- W++++ M? V--
-po+ R++ G`` !tv b+++ D--- e++++ u++ h--- f+ r++ n- y?



More information about the Python-list mailing list