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()