Do not specify invalid alignment in BoxSizer flags

Specyfing a horizontal alignment in a wxHORIZONTAL layed out BoxSizer
is pointless, and doing so throws an exception:

wx._core.wxAssertionError: C++ assertion "!(flags & wxALIGN_RIGHT)"
failed at ./src/common/sizer.cpp(2133) in DoInsert():
Horizontal alignment flags are ignored in horizontal sizers
This commit is contained in:
Stefan Brüns
2020-10-01 02:21:33 +02:00
parent 9baba68cff
commit 62cda454f1
2 changed files with 2 additions and 2 deletions

View File

@@ -56,7 +56,7 @@ class sizer_Tests(wtc.WidgetTestCase):
def test_sizerFlags(self):
bs = wx.BoxSizer()
bs.Add(wx.Panel(self.frame),
wx.SizerFlags(2).Border(wx.ALL, 5).Align(wx.ALIGN_RIGHT))
wx.SizerFlags(2).Border(wx.ALL, 5).Align(wx.ALIGN_TOP))
def test_sizerAddMany(self):
bs = wx.BoxSizer()

View File

@@ -219,7 +219,7 @@ class FMCustomizeDlg(wx.Dialog):
hsizer = wx.BoxSizer(wx.HORIZONTAL)
# add a separator between the book & the buttons area
hsizer.Add(wx.Button(self, wx.ID_OK, _("&Close")), 0, wx.EXPAND | wx.ALIGN_RIGHT)
hsizer.Add(wx.Button(self, wx.ID_OK, _("&Close")), 0, wx.EXPAND)
sz.Add(wx.StaticLine(self), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 3)
sz.Add(hsizer, 0, wx.ALIGN_RIGHT | wx.ALL, 2)