This is a subclass of wx.BufferedDC which can be used inside of an EVT_PAINT()
event handler to achieve double-buffered drawing.
Just use this class instead of wx.PaintDC and make sure wx.Window.SetBackgroundStyle
is called with wx.BG_STYLE_PAINT
somewhere in the class initialization code, and that’s all you have to do to (mostly) avoid flicker. The only thing to watch out for is that if you are using this class together with wx.Scrolled, you probably do not want to call wx.Scrolled.PrepareDC
on it as it already does this internally for the real underlying wx.PaintDC.
See also
wx.DC, wx.BufferedDC, wx.AutoBufferedPaintDC, wx.PaintDC
As with wx.BufferedDC, you may either provide the bitmap to be used for buffering or let this object create one internally (in the latter case, the size of the client part of the window is used). |
wx.
BufferedPaintDC
(BufferedDC)¶Possible constructors:
BufferedPaintDC(window, buffer, style=BUFFER_CLIENT_AREA)
BufferedPaintDC(window, style=BUFFER_CLIENT_AREA)
This is a subclass of BufferedDC which can be used inside of an EVT_PAINT() event handler to achieve double-buffered drawing.
__init__
(self, *args, **kw)¶As with wx.BufferedDC, you may either provide the bitmap to be used for buffering or let this object create one internally (in the latter case, the size of the client part of the window is used).
Pass wx.BUFFER_CLIENT_AREA
for the style parameter to indicate that just the client area of the window is buffered, or wx.BUFFER_VIRTUAL_AREA
to indicate that the buffer bitmap covers the virtual area.
__init__ (self, window, buffer, style=BUFFER_CLIENT_AREA)
__init__ (self, window, style=BUFFER_CLIENT_AREA)
window (wx.Window) –
style (int) –