[wxPython] can't stop the flashing

Hi,

I'm having trouble getting wxWindows/wxPython to stop clearing the window
with the background color before a repaint. The code is below. I've added a
do-nothing OnEraseBackground handler, which is getting called, but the
background still gets redrawn before OnPaint. If I don't set the background
color, the flash still happens, just with gtk's default gray as the color.

I'm using wxPython/wxGTK 2.3.0 on redhat 7.1 with python 2.1.1.

Any suggestions?

from wxPython.wx import *

class MyFrame(wxFrame):
    def __init__(self, parent, id, title):
        wxFrame.__init__(self, parent, id, title,
                         wxDefaultPosition, wxSize(600,500))
        self.SetBackgroundColour(wxNamedColour('purple'))
        self.bitmap = wxImage("test.jpg",
wxBITMAP_TYPE_JPEG).ConvertToBitmap()
        EVT_PAINT(self, self.OnPaint)
        EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)

    def OnPaint(self, event):
        dc = wxPaintDC(self)
        dc.DrawBitmap(self.bitmap, 0,0, false)

    def OnEraseBackground(self, event):
        pass

class MyApp(wxApp):
    def OnInit(self):
        wxImage_AddHandler(wxJPEGHandler())
        self.frame = MyFrame(NULL, -1, "py flash test")
        self.SetTopWindow(self.frame)
        self.frame.Show(true)

        return true

app = MyApp(0)
app.MainLoop()

I'm having trouble getting wxWindows/wxPython to stop clearing the window
with the background color before a repaint. The code is below. I've

added a

do-nothing OnEraseBackground handler, which is getting called, but the
background still gets redrawn before OnPaint. If I don't set the

background

color, the flash still happens, just with gtk's default gray as the color.

I'm using wxPython/wxGTK 2.3.0 on redhat 7.1 with python 2.1.1.

You should bring this up on wx-users or wx-dev. Apparently wxGTK hasn't
figured out yet how to actually prevent the erase from happening and is just
sending the event to be compatible with wxMSW. You might be able to get
some pointers on those lists for how to reduce the visible impact of the
clear for wxGTK, and also be able to lodge your complaint about it at the
same time <wink> where the right people will hear it.

···

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