[wxPython-users] Drawing question
Christopher Barker
Chris.Barker at noaa.gov
Tue Feb 13 10:44:55 PST 2007
Dj Gilcrease wrote:
> 4) It uses a mix of ClientDC and MemoryDC (I have not figured out yet
> why it uses one over the other in places)
Well, Memory DC draws to an of-screen bitmap. A ClientDC draws to the
screen immediately.
> 1) Would it be better to make a Canvas wide DC that each "layer" uses
> when it wants to draw and not delete the DC
I think so. It sure seems like overkill to create a new dc for each
object. However, it is considered a bad idea to keep DCs around forever.
Usually, one creates a DC, draws everything to it, then throws it away,
creating a new one when the drawing needs to be updated.
> 2) How is the new Graphics Device better / worse then using ClientDC
> and MemoryDC?
The new graphics device supports alpha blending, anti-aliasing, and more
sophisticated path-based drawing.
Make sure you read the relevant Wiki pages:
http://wiki.wxpython.org/index.cgi/RecipesImagesAndGraphics
and you might want to check out wx.lib.floatcanvas for an involved example.
-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