wxGraphicsContext and wxAutoBufferedPaintDC

Robin Dunn robin at alldunn.com
Tue May 6 08:34:49 PDT 2008


Robert Hölzl wrote:
> hello,
> 
> how can I use a wxGraphicsContext in a wxAutoBufferedPaintDC (on windows 
> my application is flickering extremly)?
> according to the documentation only a WindowsDC can be specified as 
> parameter to wx.GraphicsContext.Create(), but wx.AutoBufferedPaintDC() 
> is not inherited from WindowsDC...
> 
> I did my tests on wxPython 2.8.7 on a Mac and as expected it didn’t work.

The problem is that I took a shortcut in wxPython to simplify things a 
bit, and that makes it appear that wx.AutoBufferedPaintDC derives 
directly from wx.DC on all platforms instead of wx.BufferedPaintDC on 
Windows and wx.PaintDC on the others.

> 
> Is there no way to use the graphicscontext with buffered paintdcs?
> 

Instead of using wx.AutoBufferedPaintDC you can do something like this 
and have the equivalent results:

	if 'wxMSW' in wx.PlatformInfo:
		dc = wx.BufferedPaintDC(self)
	else:
		dc = wx.PaintDC(self)
	gc = wx.GraphicsContext.Create(dc)


-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!



More information about the wx-users mailing list