Search code examples
wxpython

wxpython staticbox does not display


I cannot get a static box to display under wx 2.8 on Linux Mint 17 platform. I fought for hours with this before going back to basics and trying the following code:

#!/usr/bin/python
import wx
class MyDialog(wx.Dialog):
    def __init__(self, parent, id, title):
        wx.Dialog.__init__(self, parent, id, title, size=(250, 230))

        wx.StaticBox(self, -1, 'Personal Info', (5, 5), size=(240, 170))
        wx.CheckBox(self, -1 ,'Male', (15, 30))
        wx.CheckBox(self, -1 ,'Married', (15, 55))
        wx.StaticText(self, -1, 'Age', (15, 95))
        wx.SpinCtrl(self, -1, '1', (55, 90), (60, -1), min=1, max=120)
        wx.Button(self, 1, 'Ok', (90, 185), (60, -1))

        self.Bind(wx.EVT_BUTTON, self.OnClose, id=1)

        self.Centre()
        self.ShowModal()
        self.Destroy()

    def OnClose(self, event):
        self.Close()

app = wx.App(0)
MyDialog(None, -1, 'staticbox.py')
app.MainLoop()

The label and the contents are displayed but there is no hint of a box drawn around them on the screen. Does anyone have any ideas, as to: a) Where I am going wrong? or b) Is there something about my system that would prevent box drawing?


Solution

  • The answer, for those who find themselves in a similar predicament, is to be found in the Theme, being used for the Desktop.
    In Control Centre is an Appearance setting and if you are using the Default Mint-X setting, click customise and if the controls setting is also Mint-X, it doesn't draw boxes for some reason.
    Choose any other option in the controls list and the boxes magically appear. I hope this prevents someone else wasting hours looking for the solution.