|
Prev: Re[2]: rectangle with transparency
Next: @Vadim and Julian: Detailed Guide to set up MSYS, MinGW, Eclipse CDT and wxWidgets on Windows
From: Robert Hölzl on 5 May 2008 19:25 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 didnt work. Is there no way to use the graphicscontext with buffered paintdcs? thanks a lot for help in advance, robert
From: Kevin Ollivier on 5 May 2008 20:56 Hi Robert, On May 5, 2008, at 4:25 PM, 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 didnt > work. > > Is there no way to use the graphicscontext with buffered paintdcs? For wxWebKit, we use the wxGCDC layer as a 'bridge' between the two. So, in your case, you'd code it like so: def OnPaint(self, event): paintdc = wx.AutoBufferedPaintDC(self) gcdc = wx.GCDC(paintdc) graphics_context = gcdc.GetGraphicsContext() # do painting with your graphics_context object It would be nice to go straight from one to the other, though. Regards, Kevin > > > thanks a lot for help in advance, > robert_______________________________________________ > wx-users mailing list > wx-users(a)lists.wxwidgets.org > http://lists.wxwidgets.org/mailman/listinfo/wx-users
From: Robert Roebling on 6 May 2008 06:28 Robert Hölzl wrote: > 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... Maybe get the wxBitmap from the wxAutoBufferedPaintDC, create a wxMemoryDC from it and create the wxGraphicsContext from that. Robert
From: Robin Dunn on 6 May 2008 11:34
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! |