470,643 Members | 1,551 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,643 developers. It's quick & easy.

flicker in wxBufferedPaintDC

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
Jul 18 '05 #1
1 2266

"Markus von Ehr" <vo****@ipm.fhg.de> wrote in message
news:cf**********@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
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Michael | last post: by
4 posts views Thread by Marek Mänd | last post: by
3 posts views Thread by seamlyne | last post: by
17 posts views Thread by pigeonrandle | last post: by
4 posts views Thread by Frank Rizzo | last post: by
1 post views Thread by Korara | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.