diff --git a/CHANGES.rst b/CHANGES.rst index 729df9c4..a3d206fe 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -70,6 +70,10 @@ Changes in this release include the following: * Fix type error that would occur using pycolourchooser. (#957) +* Add wrapper for wx.StaticBox.GetBordersForSizer and use it in the demo to do + platform-specific layout of the items in the StaticBox. (#974) + + 4.0.3 "The show must go on. (Die show-stoppers! Die!)" diff --git a/demo/StaticBox.py b/demo/StaticBox.py index af391417..dd86e5be 100644 --- a/demo/StaticBox.py +++ b/demo/StaticBox.py @@ -10,6 +10,9 @@ class TestPanel(wx.Panel): wx.Panel.__init__(self, parent, -1) box1 = wx.StaticBox(self, -1, "This is a wx.StaticBox") + + # This gets the recommended amount of border space to use for items + # within in the static box for the current platform. topBorder, otherBorder = box1.GetBordersForSizer() bsizer1 = wx.BoxSizer(wx.VERTICAL) bsizer1.AddSpacer(topBorder) @@ -18,12 +21,14 @@ class TestPanel(wx.Panel): bsizer1.Add(t1, 1, wx.EXPAND|wx.BOTTOM|wx.LEFT|wx.RIGHT, otherBorder+10) box1.SetSizer(bsizer1) + ## The OLD way. box2 = wx.StaticBox(self, -1, "This is a wx.StaticBox using wx.StaticBoxSizer") bsizer2 = wx.StaticBoxSizer(box2, wx.VERTICAL) t = wx.StaticText(self, -1, "Controls placed \"inside\" the box are really its siblings. This method of using wx.StaticBox is deprecated since wxPython 2.9, and can cause issues on some platforms.") bsizer2.Add(t, 1, wx.EXPAND|wx.TOP|wx.LEFT, 10) + border = wx.BoxSizer(wx.VERTICAL) border.Add(box1, 1, wx.EXPAND|wx.ALL, 25) border.Add(bsizer2, 1, wx.EXPAND|wx.ALL, 25)