Reducing flicker on Windows using SetDoubleBuffered()

Hi all,

I have an application which consists of some pretty standard components (wx.SplitterWindow, wx.Frame, wx.ListCtrl, etc) and have noticed than in Windows the applications flickers a lot when redrawing text to the screen. In Linux this is not a problem, so it appears to be platform-dependent.

I looked around some some information on using double-buffering, including a “SetDoubleBuffered()” option. I’m not really sure what I need to do though. The cookbook recipe on double buffering seems like it may be geared more towards custom components and drawing. I tried simply calling “self.SetDoubleBuffered(True)” in the parent wx.Frame object’s constructor, but doing that caused the child list to not be properly drawn.

Any suggestions? I’ve never dealt with double-buffering before and am still new to wxPython so any advice people could provide would be greatly appreciated.

Thanks,

Keith

Hi all,

I have an application which consists of some pretty standard components
(wx.SplitterWindow, wx.Frame, wx.ListCtrl, etc) and have noticed than in
Windows the applications flickers a lot when redrawing text to the
screen. In Linux this is not a problem, so it appears to be
platform-dependent.

Please make a runnable, small as possible, sample application that demonstrates the problem, attach it to your mail. MakingSampleApps - wxPyWiki

I looked around some some information on using double-buffering,
including a "SetDoubleBuffered()" option. I'm not really sure what I
need to do though. The cookbook recipe on double buffering seems like it
may be geared more towards custom components and drawing. I tried simply
calling "self.SetDoubleBuffered(True)" in the parent wx.Frame object's
constructor, but doing that caused the child list to not be properly drawn.

Any suggestions? I've never dealt with double-buffering before and am
still new to wxPython so any advice people could provide would be
greatly appreciated.

SetDoubleBuffered just sets a native flag on the Window on MSW. It was added in XP and sometimes had some strange side-effects there. It's better on newer versions of Windows. That said, you really should not be getting much flicker on Windows unless you are implementing paint events yourself. So please send us a sample that duplicates the problem and perhaps we can help point out what can be done differently.

···

On 8/1/11 4:48 AM, Keith Hughitt wrote:

--
Robin Dunn
Software Craftsman

Hi Robin,

Thanks for the insight and offer to help. I followed your suggestion and created a simple demo application with only the major UI components, but it does not suffer any of the flickering problems just yet. This should provide some insight, however, and I will take a closer look at the larger application to see what could be causing the flicker.

For reference, I am testing the application on Windows XP at the moment. I’ll try and test the same application on Windows 7 when I can get access and see if the problem persists.

Thanks,
Keith