Notebook tab color problem

Hello,

I am having a problem with notebook tab colors. Specifically, there is a color beside the tabs that is supposed to be transparent that seems to get set incorrectly when I have a nested notebook.

Here is my example code:

#!/usr/bin/env python
# -*- coding: ISO-8859-1 -*-
# generated by wxGlade 0.3.5.1 on Tue Jul 05 08:04:56 2005

import wx

#from rwkfilechooserpanel import rwkfilechooserpanel

class MyFrame(wx.Frame):
    def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.panel_1 = wx.Panel(self, -1)
        self.notebook_1 = wx.Notebook(self.panel_1, -1, style=0)
        self.notebook_1_pane_1 = wx.Panel(self.notebook_1, -1)
        self.notebook_2 = wx.Notebook(self.notebook_1_pane_1, -1, style=0)
        self.notebook_2_pane_2 = wx.Panel(self.notebook_2, -1)
        self.notebook_2_pane_1 = wx.Panel(self.notebook_2, -1)
        self.label_6 = wx.StaticText(self.notebook_1_pane_1, -1, "label_6")
        self.label_7 = wx.StaticText(self.notebook_1_pane_1, -1, "label_7")
        self.label_1 = wx.StaticText(self.notebook_2_pane_1, -1, "Hello")
        self.label_5 = wx.StaticText(self.notebook_2_pane_2, -1, "label_5")
        self.label_8 = wx.StaticText(self.notebook_1_pane_1, -1, "label_8")
        self.notebook_1_pane_2 = wx.Panel(self.notebook_1, -1)

        self.__set_properties()
        self.__do_layout()
        # end wxGlade
# mygray=self.panel_1.GetBackgroundColour()
# self.label_5.SetBackgroundColour(mygray)
# self.notebook_2_pane_2.SetBackgroundColour(mygray)
# self.notebook_2.SetBackgroundColour(wx.BLUE)
# self.window_1.SetBackgroundColour(mygray)
# self.notebook_2_pane_1.SetBackgroundColour(mygray)

    def __set_properties(self):
        # begin wxGlade: MyFrame.__set_properties
        self.SetTitle("frame_1")
        self.SetSize((400, 300))
        self.label_7.Hide()
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: MyFrame.__do_layout
        sizer_2 = wx.BoxSizer(wx.VERTICAL)
        grid_sizer_2 = wx.FlexGridSizer(1, 1, 0, 0)
        grid_sizer_4 = wx.FlexGridSizer(3, 2, 0, 0)
        grid_sizer_6 = wx.FlexGridSizer(2, 1, 0, 0)
        grid_sizer_5 = wx.FlexGridSizer(2, 1, 0, 0)
        grid_sizer_4.Add(self.label_6, 0, wx.FIXED_MINSIZE, 0)
        grid_sizer_4.Add(self.label_7, 0, wx.FIXED_MINSIZE, 0)
        grid_sizer_5.Add(self.label_1, 0, wx.FIXED_MINSIZE, 0)
        self.notebook_2_pane_1.SetAutoLayout(True)
        self.notebook_2_pane_1.SetSizer(grid_sizer_5)
        grid_sizer_5.Fit(self.notebook_2_pane_1)
        grid_sizer_5.SetSizeHints(self.notebook_2_pane_1)
        grid_sizer_5.AddGrowableRow(1)
        grid_sizer_5.AddGrowableCol(0)
        grid_sizer_6.Add(self.label_5, 0, wx.FIXED_MINSIZE, 0)
        self.notebook_2_pane_2.SetAutoLayout(True)
        self.notebook_2_pane_2.SetSizer(grid_sizer_6)
        grid_sizer_6.Fit(self.notebook_2_pane_2)
        grid_sizer_6.SetSizeHints(self.notebook_2_pane_2)
        grid_sizer_6.AddGrowableRow(1)
        grid_sizer_6.AddGrowableCol(0)
        self.notebook_2.AddPage(self.notebook_2_pane_1, "tab3")
        self.notebook_2.AddPage(self.notebook_2_pane_2, "tab4")
        grid_sizer_4.Add(wx.NotebookSizer(self.notebook_2), 1, wx.EXPAND, 0)
        grid_sizer_4.Add(self.label_8, 0, wx.FIXED_MINSIZE, 0)
        self.notebook_1_pane_1.SetAutoLayout(True)
        self.notebook_1_pane_1.SetSizer(grid_sizer_4)
        grid_sizer_4.Fit(self.notebook_1_pane_1)
        grid_sizer_4.SetSizeHints(self.notebook_1_pane_1)
        grid_sizer_4.AddGrowableRow(1)
        grid_sizer_4.AddGrowableCol(0)
        self.notebook_1.AddPage(self.notebook_1_pane_1, "tab1")
        self.notebook_1.AddPage(self.notebook_1_pane_2, "tab2")
        grid_sizer_2.Add(wx.NotebookSizer(self.notebook_1), 1, wx.EXPAND, 0)
        self.panel_1.SetAutoLayout(True)
        self.panel_1.SetSizer(grid_sizer_2)
        grid_sizer_2.Fit(self.panel_1)
        grid_sizer_2.SetSizeHints(self.panel_1)
        grid_sizer_2.AddGrowableRow(0)
        grid_sizer_2.AddGrowableCol(0)
        sizer_2.Add(self.panel_1, 1, wx.EXPAND, 0)
        self.SetAutoLayout(True)
        self.SetSizer(sizer_2)
        self.Layout()
        # end wxGlade

# end of class MyFrame

class MyApp(wx.App):
    def OnInit(self):
        wx.InitAllImageHandlers()
        frame_1 = MyFrame(None, -1, "")
        self.SetTopWindow(frame_1)
        frame_1.Show()
        return 1

# end of class MyApp

if __name__ == "__main__":
    app = MyApp(0)
    app.MainLoop()

If you run this code, the frame should open up and you should be looking at a notebook nested within tab1 of the parent notebook. Tab1 also contains some labels. There is gray space beside the tabs of the nested notebook that I can't seem to change to be white.

Thanks for your help,

Ryan

1 Like