X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bb0054cda81e7a6a6e1f33f4b47e46f529110f14..2356708db31b737c6eae53c2316b642aa5a2e68d:/utils/wxPython/demo/Sizers.py diff --git a/utils/wxPython/demo/Sizers.py b/utils/wxPython/demo/Sizers.py index 6ebdfcf8c4..02befadba1 100644 --- a/utils/wxPython/demo/Sizers.py +++ b/utils/wxPython/demo/Sizers.py @@ -111,21 +111,17 @@ def makeSimpleBorder3(win): def makeBoxInBox(win): box = wxBoxSizer(wxVERTICAL) - btn = wxButton(win, 1010, "one") - box.Add(btn) + box.Add(wxButton(win, 1010, "one")) box2 = wxBoxSizer(wxHORIZONTAL) - btn = wxButton(win, 1010, "two") - box2.Add(btn) - btn = wxButton(win, 1010, "three") - box2.Add(btn) - btn = wxButton(win, 1010, "four") - box2.Add(btn) - btn = wxButton(win, 1010, "five") - box2.Add(btn) + box2.AddMany([ wxButton(win, 1010, "two"), + wxButton(win, 1010, "three"), + wxButton(win, 1010, "four"), + wxButton(win, 1010, "five"), + ]) box3 = wxBoxSizer(wxVERTICAL) - box3.AddMany([ (wxButton(win, 1010, "six"), 1), + box3.AddMany([ (wxButton(win, 1010, "six"), 0), (wxButton(win, 1010, "seven"), 2), (wxButton(win, 1010, "eight"), 1), (wxButton(win, 1010, "nine"), 1), @@ -134,8 +130,7 @@ def makeBoxInBox(win): box2.Add(box3, 1) box.Add(box2, 1) - btn = wxButton(win, 1010, "ten") - box.Add(btn) + box.Add(wxButton(win, 1010, "ten")) return box @@ -152,18 +147,27 @@ def makeBoxInBorder(win): def makeBorderInBox(win): insideBox = wxBoxSizer(wxHORIZONTAL) - insideBox.Add(makeSimpleBox3(win), 1) + + box2 = wxBoxSizer(wxHORIZONTAL) + box2.AddMany([ wxButton(win, 1010, "one"), + wxButton(win, 1010, "two"), + wxButton(win, 1010, "three"), + wxButton(win, 1010, "four"), + wxButton(win, 1010, "five"), + ]) + + insideBox.Add(box2, 0) bdr = wxBorderSizer(wxALL) bdr.Add(wxButton(win, 1010, "border"), 20) insideBox.Add(bdr, 1) box3 = wxBoxSizer(wxVERTICAL) - box3.AddMany([ (wxButton(win, 1010, "six"), 1), + box3.AddMany([ (wxButton(win, 1010, "six"), 0), (wxButton(win, 1010, "seven"), 2), (wxButton(win, 1010, "eight"), 1), (wxButton(win, 1010, "nine"), 1), - ]) + ]) insideBox.Add(box3, 1) outsideBox = wxBoxSizer(wxVERTICAL) @@ -238,7 +242,7 @@ theTests = [ ), ("Border in a Box", makeBorderInBox, - "" + "Another nesting example. This one has Boxes and a Border inside another Box." ), ] @@ -251,11 +255,10 @@ class TestFrame(wxFrame): self.sizer = sizerFunc(self) self.CreateStatusBar() - + self.SetStatusText("Resize this frame to see how the sizers respond...") self.sizer.FitWindow(self) - def OnSize(self, event): size = self.GetClientSize() self.sizer.Layout(size)