No enclosing box with wx.StaticBox / wx.StaticBoxSizer

I am confused as I get no enclosing box when using wx.StaticBox / wx.StaticBoxSizer - yet many examples show this.
The following shows the text but no box!

import wx
class MyPanel(wx.Panel):
    def __init__(self, parent):
        box = wx.StaticBox(self, -1, "This is a wx.StaticBox")
        bsizer = wx.StaticBoxSizer(box, wx.VERTICAL)
        t = wx.StaticText(self, -1, "Controls placed \"inside\" the box are really its siblings")
        bsizer.Add(t, 0, wx.TOP|wx.LEFT, 10)
        border = wx.BoxSizer()
        border.Add(bsizer, 1, wx.EXPAND|wx.ALL, 25)

class MyFrame(wx.Frame):
    def __init__(self):
        super().__init__(None, title='Test')
        panel = MyPanel(self)

if __name__ == '__main__':
    app = wx.App(False)
    frame = MyFrame()

I am running Ubuntu MATE 18.04

Can anyone explain what is wrong, please?

It’s possible that your current GTK theme does not draw the staticbox. You should be able to check if that is the case by experimenting with different widget theme settings in your system preferences.

1 Like

Was using TradionalOk - Abient-MATE shows the lines!
Thanks so much for the assistance.

I’m facing the same problem and using the same theme (TraditionalOk). I’m thinking of modifying the theme to make the border visible, but I’m having difficulties finding the right CSS selector :frowning:

Ok it’s just “border”… Thanks GTK_DEBUG=interactive :smiley:

For the record, just adding this

border {
    border-color: #bbbbbb;
    border-style: solid;
    border-width: 1px;

to /usr/share/themes/TraditionalOk/gtk-3.0/gtk-widgets.css fixed my problem.