Graphics Contexts and DCs explanations?

RgeeK Ross at no.thanks.spammers
Tue Aug 19 14:16:47 EDT 2008


Experimenting with graphics in an app: it's AUI based with a few panes, 
one of which has a panel containing a few sizers holding UI elements. 
One sizer contains a panel that needs some basic line-drawing graphics 
in it.

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?)

The scrolledWindow and GraphicsContext examples are helpful, but it 
appears I can draw a rectangles, lines and text in either just a 
straight wxPaintDC, or can do:

dc = wx.PaintDC(self)
gc = wx.GraphicsContext.Create(dc)

...and do the same drawing with gc.DrawText etc...

Can someone clarify the differences or added value of the gc over the 
dc, and is using the dc alone a valid approach?  Where will it end up 
biting me - I don't mean which body part :)  Perhaps I should say in 
which situation will it bite...

Thx,
Ross.



More information about the Python-list mailing list