Q:

Better way to Set Background Color with wx.DC

Right now, I am setting the background colour like this,
dc.DrawRectangle(0,0,width,height)
Do you know a better way to set the background color? 
http://wxpython.org/docs/api/wx.DC-class.html

A:

If you're already painting on a wx.DC to draw the rest of the window's content then the best way is to set the background brush, and then clear the DC.  Something like this:
def OnPaint(self, event):
    dc= wx.PaintDC(self)
    dc.SetBackground(wx.Brush(someColour))
    dc.Clear()
    # other drawing stuff...

If you are setting the colour with the window's SetBackgroundColour method, then you can use that instead of some fixed colour value, like this:
def OnPaint(self, event):
    dc= wx.PaintDC(self)
    dc.SetBackground(wx.Brush(self.GetBackgroundColour()))
    dc.Clear()
    # other drawing stuff...

A:

The normal way, which works for most windows, including buttons and other widgets is to call wxWindow::SetBackgroundColour()
http://docs.wxwidgets.org/2.8/wx_wxwindow.html#wxwindowsetbackgroundcolour
The neat thing is that if you call this on the topmost parent, all the children will automatically inherit the same background colour.  See the link for how exactly this works.

