wxNotebook & XP theme

Yes, this is annoying, but it is a product of how messy XP's theming
APIs are. With the default theme, a notebook page uses a gradient, from
white to beige. But even this doesn't always look right, and microsoft
isn't consistent even within XP on notebook pages.

I've tried to make wx do the right thing, and let the theme engine draw
the bg, but to no avail.

At the moment I'm using a patched version of wxWindows so that the
notebook panel background is the same color as a normal panel, but you
can achieve the same effect with this code:

def savebg(win):
  l = [win]
  bg = {}
  while l:
    win = l.pop(0)
    if isinstance(win, wxButton):
       # or isinstance(win, wxBitmapButton):
      continue
    # print win
    l += win.GetChildren()
    bg[win] = win.GetBackgroundColour()
  return bg
  
def restorebg(win, bg):
  l = [win]
  while l:
    win = l.pop(0)
    l += win.GetChildren()
    try: win.SetBackgroundColour(bg[win])
    except KeyError: pass

# add a page like this
bg = savebg(mypage)
nb.AddPage(mypage, 'My Page')
restorebg(mypage, bg)

ยทยทยท

On Thu, Sep 11, 2003 at 10:05:30AM +0200, Jens.Bloch.Helmers@dnv.com wrote:

The background colour on wxNotebooks looks slightly too white compared
to Microsofts notebooks. (eg. Compared to Control panel -> display).
I'm not particulary happy with the Microsoft look, but wxPython apps
using wxNotebooks looks a bit pale.

I'm using python 2.2.2, wxpython 2.4.1.2 and default XP themes.