Alignment problem causes C++ assertion error

I’m working with a new windows machine.
Python version is ‘3.9.12 (main, Apr 4 2022, 05:22:27) [MSC v.1916 64 bit (AMD64)]’.
wxPython is version ‘4.2.0 msw (phoenix) wxWidgets 3.2.0’.
I get the following error:
Traceback (most recent call last):

File “C:\Users\kteague\scripts\”, line 393, in init
bSizer9.Add( self.m_buttonVerifyUpdate, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
wx._core.wxAssertionError: C++ assertion “CheckSizerFlags(!((flags) & (wxALIGN_RIGHT)))” failed at …\src\common\sizer.cpp(2271) in wxBoxSizer::DoInsert(): wxALIGN_RIGHT will be ignored in this sizer: only vertical alignment flags can be used in horizontal sizers


If you’re an end user running a program not developed by you, please ignore this message, it is harmless, and please try reporting the problem to the program developers.

You may also set WXSUPPRESS_SIZER_FLAGS_CHECK environment variable to suppress all such checks when running this program.

If you’re the developer, simply remove this flag from your code to avoid getting this message. You can also call wxSizerFlags::DisableConsistencyChecks() to globally disable all such checks, but this is strongly not recommended.

… and then the script dies. I used wxFormBuilder to auto-generate the GUI code (so I’m not supposed to edit the problematic file)
This works on my old Windows machine, Python 3.7.3, wx version 4.04.
Any ideas? Thank you in advance.

I think you shouldn’t use horizontal alignment flags in a vertical sizer.

The sizer improper flags assertions were added in 4.1 timeframe, if I remember correctly. Basically it’s telling you that the flags make no sense in the context they are used. Yes, they will have no effect at runtime, but it’s still technically a programming error. Unfortunately since they used the wx assert mechanism then they are turned into Python exceptions, so they’re not as easily ignored as they can be in C++ but you can do what is suggested in the assertion message.

As @steve2 mentioned, the proper fix is to not use horizontal flags in vertical sizers, and vice versa. If wxFormBuilder doesn’t let you do that then it should be considered a wxFB bug.