Graphics Contexts and DCs explanations?
timr at probo.com
Fri Aug 22 08:28:21 CEST 2008
RgeeK <Ross at no.thanks.spammers> wrote:
>I use the wxPython demo app heavily to figure this stuff out, and my
>experiments seem to work, but I'm flying blind somewhat.
>Can someone englighten me about the wx.GraphicsContext versus wx.PaintDC
> (BTW what does PaintDC stand for? Drawing Context perhaps?)
Yes. The DC is a concept straight from the Windows GDI API. It holds your
current surface, your current foreground and background colors, your
current pattern, your current raster op, etc. In X, the same concept is
called a "gc" -- graphics context.
Windows requires special handling to create a DC within a WM_PAINT handler
(which is what calls OnPaint). That's why wx.PaintDC is separate. Outside
of OnPaint, you'd usually use wx.ClientDC.
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-list