Looking at the console window, it looks like OnPaint() is getting called
continuously. Does that seem right?
That happens on MSW if a wxPaintDC is not created for the window the event
was sent to.
Here's a little simpler version of the sample that doesn't have that
problem:
from wxPython.wx import *
ID_ABOUT = 101
ID_EXIT = 102
class MyFrame(wxFrame):
def __init__(self, parent, ID, title):
wxFrame.__init__(self, parent, ID, title,
wxDefaultPosition, wxSize(200, 150))
self.panel1 = wxPanel(self,-1,wxDefaultPosition, (100,100),
wxSUNKEN_BORDER)
self.panel2 = wxPanel(self,-1,wxDefaultPosition, (100,100),
wxSUNKEN_BORDER)
self.panel1.SetBackgroundColour("BLUE")
self.panel2.SetBackgroundColour("RED")
box = wxBoxSizer(wxVERTICAL)
box.Add(self.panel1, 1, wxEXPAND)
box.Add(self.panel2, 1, wxEXPAND)
box.Fit(self)
self.SetAutoLayout(true)
self.SetSizer(box)
class MyApp(wxApp):
def OnInit(self):
frame = MyFrame(NULL, -1, "Sizer Test")
frame.Show(true)
self.SetTopWindow(frame)
return true
app = MyApp(0)
app.MainLoop()