flicker in wxBufferedPaintDC

Tom B. sbabbitt at commspeed.net
Tue Aug 10 11:07:12 EDT 2004


"Markus von Ehr" <vonehr at ipm.fhg.de> wrote in message
news:cfaj0e$b4f$1 at news2.rz.uni-karlsruhe.de...
> Hi,
>
> I actualize a buffer in an event handler routine:
>
> if BUFFERED:
>          # If doing buffered drawing, create the buffered DC, giving it
>          # it a real DC to blit to when done.
>          cdc = wxClientDC(self)
>          dc = wxBufferedDC(cdc, self.buffer)
>
>          dc.BeginDrawing()
>          if self.image:
>              dc.DrawBitmap(self.image.ConvertToBitmap(), 0,0)
>          dc.EndDrawing()
>
> and paint the buffer in the OnPaint method.
>
>       def OnPaint(self, event):
>          if BUFFERED:
>              # Create a buffered paint DC.  It will create the real
>              # wxPaintDC and then blit the bitmap to it when dc is
>              # deleted.  Since we don't need to draw anything else
>              # here that's all there is to it.
>              dc = wxBufferedPaintDC(self, self.buffer)
>          else:
>              dc = wxPaintDC(self)
>              # since we're not buffering in this case, we have to
>              # paint the whole window, potentially very time consuming.
>              self.DoDrawing(dc)
>
>
> but the window is flickering. The window displays the liveimage of a
> connected camera.
> How could I get rid of the flickering?
>
> Thanks for any hints,
>
> Markus


You could try using a self.PrepareDC(dc),
or perhaps a wx.SafeYeild(),
or perhaps you need the wx.NO_FULL_REPAINT_ON_RESIZE flag set,
or perhaps you just need to speed up execution , try
http://psyco.sourceforge.net/.

hope this helps.
Tom





More information about the Python-list mailing list