From d79d9859cb8b3cf1beabee93718a27fd5ed2148f Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 23 Oct 2019 18:11:20 -0700 Subject: [PATCH] Switch to a sizer in the superdoodle about box --- samples/doodle/superdoodle.py | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/samples/doodle/superdoodle.py b/samples/doodle/superdoodle.py index e8d148fe..d6bcad69 100644 --- a/samples/doodle/superdoodle.py +++ b/samples/doodle/superdoodle.py @@ -18,6 +18,7 @@ import wx import wx.html from wx.lib import buttons # for generic button classes from doodle import DoodleWindow +import version from wx.lib.mixins.inspection import InspectionMixin @@ -349,7 +350,7 @@ class DoodleAbout(wx.Dialog): text = ''' - +
@@ -369,7 +370,7 @@ instructions:

SuperDoodle and wxPython are brought to you by Robin Dunn and Total Control Software, Copyright -© 1997-2011.

+© 1997-2019.

''' @@ -379,29 +380,18 @@ instructions:

size=(420, 380) ) html = wx.html.HtmlWindow(self, -1) - import version html.SetPage(self.text % version.VERSION) button = wx.Button(self, wx.ID_OK, "Okay") - # constraints for the html window - lc = wx.LayoutConstraints() - lc.top.SameAs(self, wx.Top, 5) - lc.left.SameAs(self, wx.Left, 5) - lc.bottom.SameAs(button, wx.Top, 5) - lc.right.SameAs(self, wx.Right, 5) - html.SetConstraints(lc) - - # constraints for the button - lc = wx.LayoutConstraints() - lc.bottom.SameAs(self, wx.Bottom, 5) - lc.centreX.SameAs(self, wx.CentreX) - lc.width.AsIs() - lc.height.AsIs() - button.SetConstraints(lc) - - self.SetAutoLayout(True) + # Set up the layout with a Sizer + sizer = wx.BoxSizer(wx.VERTICAL) + sizer.Add(html, wx.SizerFlags(1).Expand().Border(wx.ALL, 5)) + sizer.Add(button, wx.SizerFlags(0).Align(wx.ALIGN_CENTER).Border(wx.BOTTOM, 5)) + self.SetSizer(sizer) self.Layout() + self.CentreOnParent(wx.BOTH) + wx.CallAfter(button.SetFocus) #----------------------------------------------------------------------