[NEWBIE] Redraw flicker

Hi all!

Does anybody know how to get rid of the annoying window redraw flicker when resizing a wxFrame instance (more specifically, that of my class that inherits from it)? I looked at the docs, and found this:

"wxCLIP_CHILDREN -- Use this style to eliminate flicker caused by the background being repainted, then children being painted over them. Windows only."

But calling SetWindowStyleFlag(wxCLIP_CHILDREN) on the instance of my class changes nothing. Besides, I lose the title bar when I set the flag!

All of the examples in the demo flicker. Is it really impossible to do? Do I need to inherit my class from wxWindow, instead of wxFrame?

···

###################################################
Here's the code:

class MyFrame(wxFrame):
     def __init__(self, title):
         wxFrame.__init__(self, NULL, -1, title,
                  size = wxSize(600, 400))
         self.SetWindowStyleFlag(wxCLIP_CHILDREN)

class MyApp(wxApp):
     def OnInit(self):
         frame = MyFrame('Test')
         frame.Show(true)
         self.SetTopWindow(frame)
         return true

app = MyApp(0)
app.MainLoop()

That fixed it!

Thanks a bunch, Robb!

Robb Shecter wrote:

···

Denis Treskunov wrote:

Hi all!

Does anybody know how to get rid of the annoying window redraw flicker...

I've had really good luck doing something like this (on MSW). What's going on here is that there are two styles to set, and you want to set them in the baseclass constructor. Here's a reusable wxFrame subclass that will do this transparently. I do something similar for wxPanels:

STYLE=wxCLIP_CHILDREN|wxNO_FULL_REPAINT_ON_RESIZE

class ApplicationFrame(wxFrame):
   def __init__(self,
                parent=None,
                id=-1,
                title='ApplicationFrame',
                pos=wxDefaultPosition,
                size=wxDefaultSize,
                style=wxDEFAULT_FRAME_STYLE,
                ):
       wxFrame.__init__(self,
                        parent,
                        id=id,
                        title=title,
                        size=size,
                        pos=pos,
                        style=style|STYLE,
                        )

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org