Icon background color in wx.CollapsiblePane

When I create a collapsible panel, it has an icon to click to collapse it. This icon has a background color that is different than the background color I set for the panel. The panel background color of the enclosing panel doesn’t matter either. I am experiencing this on Windows. On MacOS it seems to work just fine and ‘blend in’ with the background.

How can I change the background color so that button either blends in with the rest?

Code that shows the problem:


import wx
import wx.xrc

class MyFrame ( wx.Frame ):

    def __init__( self, parent ):
        wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition,  style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
        bSizer = wx.BoxSizer( wx.VERTICAL )

        self.m_collapsiblePane = wx.CollapsiblePane( self, wx.ID_ANY, u"collapsible", wx.DefaultPosition, wx.Size( 200,200 ), wx.CP_DEFAULT_STYLE|wx.TRANSPARENT_WINDOW )
        self.m_collapsiblePane.Collapse( False )
        self.m_collapsiblePane.SetBackgroundColour( wx.Colour( 0, 150, 150 ) )

        bSizer1 = wx.BoxSizer( wx.VERTICAL )
        self.m_button1 = wx.Button( self.m_collapsiblePane.GetPane(), wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0 )
        bSizer1.Add( self.m_button1, 0, wx.ALL, 0 )

        self.m_collapsiblePane.GetPane().SetSizer( bSizer1 )
        self.m_collapsiblePane.GetPane().Layout()
        bSizer.Add( self.m_collapsiblePane, 1, wx.EXPAND |wx.ALL, 0 )

        self.SetSizer( bSizer )
        self.Layout()
        self.Centre( wx.BOTH )

    def __del__( self ):
        pass

app = wx.App()
frame = MyFrame(parent=None)
frame.Show()
app.MainLoop()

Screenshot:

Does the silence mean there is no solution for this one?

There are not any APIs that give access to the sub-widgets of the CollabsiblePane, probably because there are different internal implementations (native or generic, etc.) on different platforms. You may be able to use self.m_collapsiblePane.Children[0] to get a generic reference to the header widget if the generic version is being used, but there is no access from there to the button’s bitmap.