Custom Statusbar crashes on Mac with wxpython 4.1

Hello,

I’m just switching from wxpython 4.0.7.post2 to wxpython 4.1.
I use a custom Statusbar in my apps in order to use a custom background colour.
This has worked with wxpython 4.0.7 on Mac
image
and on Windows:
image

With wxpython 4.1 it stil works on Windows but crashes on Mac with the following
Exception:

Traceback (most recent call last):
  File "... /statusbar.py", line 122, in <module>
    window = TestFrame(None)
  File "... /statusbar.py", line 110, in __init__
    self.statusBar = ColouredStatusbar(self, wx.ID_ANY, 3)
  File "... /statusbar.py", line 31, in __init__
    self.SetBackgroundStyle(wx.BG_STYLE_COLOUR)
wx._core.wxAssertionError: C++ assertion ""(m_backgroundStyle != wxBG_STYLE_TRANSPARENT) || (style == wxBG_STYLE_TRANSPARENT)"" 
failed at /Users/robind/projects/bb2/dist-osx-py36/build/ext/wxWidgets/src/common/wincmn.cpp(1663) 
in SetBackgroundStyle(): wxBG_STYLE_TRANSPARENT can't be unset once it was set.

Bug or feature? Can I do anything to circumvent this problem?

I use python 3.7.7 64-bit on Windows 7
and python 3.6.5 on Mac Mojave (10.14.6)

I have attached a runnable test application.
statusbar.py (4.5 KB)

All the best
Eigi

I expect that it’s an intentional change, or at least related to an intended change. You can ask about it on wx-users to be sure if you want to know for sure…

Probably the best workaround would be to create a generic widget instead of using the native statusbar. The basically philosophy of wx is that using the native widgets as they are intended to be used is sure to work well. Trying to use a native widget in an unintended way may or may not work well.

Hello Robin,

I have switched back to the default implementation of the StatusBar. Since the current implementation is somehow transparent it inherits the the background colour of it’s parent frame. Therefore I don’t have a need for a custom coloured StatusBar anymore. Thank you very much.

Best
Eigi