wx.BufferedDC question

From the docs:

"""
This is a subclass of wxBufferedDC which can be used inside of an
OnPaint() event handler. Just create an object of this class instead
of wxPaintDC and that's all you have to do to (mostly) avoid flicker.
"""

I'm wondering in which circumstances both wx.BufferedDC and wx.BufferedPaintDC
can cause flickering. As a matter of fact, I rely heavily in
wx.BufferedPaintDC for alpha-blended controls, and the flicker is
quite evident, to the point where it doesn't seem to work. Is not
supplying a manual buffer the cause of this?

-F

Hello Federico,

I'm wondering in which circumstances both wx.BufferedDC and
wx.BufferedPaintDC can cause flickering. As a matter of fact,
I rely heavily in wx.BufferedPaintDC for alpha-blended
controls, and the flicker is quite evident, to the point
where it doesn't seem to work. Is not supplying a manual
buffer the cause of this?

Have you looked at:

http://wiki.wxpython.org/index.cgi/DoubleBufferedDrawing

? It is extremely useful to handle custom-drawn controls.

HTH.

Andrea.

···

_________________________________________
Andrea Gavana (gavana@kpo.kz)
Reservoir Engineer
KPDL
4, Millbank
SW1P 3JA London

Direct Tel: +44 (0) 20 717 08936
Mobile Tel: +44 (0) 77 487 70534
Fax: +44 (0) 20 717 08900
Web: http://xoomer.virgilio.it/infinity77
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

Federico Ceccatto wrote:

From the docs:

"""
This is a subclass of wxBufferedDC which can be used inside of an
OnPaint() event handler. Just create an object of this class instead
of wxPaintDC and that's all you have to do to (mostly) avoid flicker.
"""

I'm wondering in which circumstances both wx.BufferedDC and wx.BufferedPaintDC
can cause flickering. As a matter of fact, I rely heavily in
wx.BufferedPaintDC for alpha-blended controls, and the flicker is
quite evident, to the point where it doesn't seem to work. Is not
supplying a manual buffer the cause of this?

Flicker happens when drawing is done to the screen in multiple discreet steps, but that is what using a buffer is supposed to prevent. The only thing drawn to the screen is the buffer bitmap and it is done in a single step, so you need to look for the source of your flicker elsewhere. My guess is that it is probably happening in the EVT_ERASE_BACKGROUND event, but since you are drawing the whole window via the buffer you can safely catch EVT_ERASE_BACKGROUND and do nothing in the handler.

···

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

That's it, I wasn't overriding the default handler for EVT_ERASE_BACKGROUND

Many thanks

-F