From 4a7d84ec8c7e63f92c48ae66921fc7bbf5c58339 Mon Sep 17 00:00:00 2001 From: kollivier Date: Wed, 8 Nov 2017 13:33:17 -0800 Subject: [PATCH] Add example showing usage of SizedStaticBox now that we can support it. --- demo/SizedControls.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/demo/SizedControls.py b/demo/SizedControls.py index df4afae0..3fa7b73b 100644 --- a/demo/SizedControls.py +++ b/demo/SizedControls.py @@ -313,6 +313,23 @@ class GridFrame(sc.SizedFrame): self.SetMinSize(self.GetSize()) +class StaticBoxFrame(sc.SizedFrame): + def __init__(self, parent, id): + sc.SizedFrame.__init__(self, parent, id, "Static Box Demo Frame (2.9+)") + + pane = self.GetContentsPane() + + box = sc.SizedStaticBox(pane, -1, "I am a sized static box") + box.SetSizerProps(expand=True, proportion=1) + text = wx.StaticText(box, -1, "Now that controls can have wx.StaticBox as a parent, SizedControls supports static boxes via the SizedStaticBox class!") + text.SetSizerProps(expand=True, proportion=1) + + self.CreateStatusBar() # should always do this when there's a resize border + + self.Fit() + self.SetMinSize(self.GetSize()) + + #--------------------------------------------------------------------------- class TestPanel(sc.SizedScrolledPanel): @@ -337,6 +354,9 @@ class TestPanel(sc.SizedScrolledPanel): b3.SetSizerProps({'halign': 'center', 'border': ('all', 15)}) self.Bind(wx.EVT_BUTTON, self.OnGridButton, b3) + b4 = wx.Button(self, -1, "Sized Controls Static Box Demo") + b4.SetSizerProps({'halign': 'center', 'border': ('all', 15)}) + self.Bind(wx.EVT_BUTTON, self.OnStaticBoxButton, b4) def OnFormButton(self, evt): @@ -390,6 +410,13 @@ class TestPanel(sc.SizedScrolledPanel): dlg.Show() + def OnStaticBoxButton(self, evt): + + dlg = StaticBoxFrame(self, -1) + dlg.CenterOnScreen() + + dlg.Show() + def runTest(frame, nb, log): win = TestPanel(nb, log) return win