Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The item will be centered horizontally in the space allotted to it by the sizer #767

Open
tellts opened this issue Feb 3, 2023 · 2 comments

Comments

@tellts
Copy link

tellts commented Feb 3, 2023

I downloaded and installed the latest version of Windows 10 a few days ago.
For the project, I set Python code generation.

  1. I added Frame
  2. I added BoxSizer
  3. I added wxStaticText
    If I click on a button with functionality:
    After generating the program code and adding these lines below to the program file (gui4.py):
    app = wx.App()
    frame = MainFrame(None).Show()
    app.MainLoop()
    I see that the program does not start and there is a description in the console:
    Traceback (most recent call last):
    File "j:\LUA\GUI\wxFormBuilder\test\a2\gui4.py", line 44, in
    frame = MainFrame(None).Show()
    File "j:\LUA\GUI\wxFormBuilder\test\a2\gui4.py", line 31, in init
    bSizer1.Add( self.HelloText, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.EXPAND, 5 )
    wx._core.wxAssertionError: C++ assertion "CheckSizerFlags(!((flags) & (wxALIGN_RIGHT | wxALIGN_CENTRE_HORIZONTAL | wxALIGN_BOTTOM | wxALIGN_CENTRE_VERTICAL)))" failed at ....\src\common\sizer.cpp(2294) in wxBoxSizer::DoInsert(): wxALIGN_RIGHT | wxALIGN_CENTRE_HORIZONTAL | wxALIGN_BOTTOM | wxALIGN_CENTRE_VERTICAL will be ignored in this sizer: wxEXPAND overrides alignment flags in box sizers

DO NOT PANIC !!

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.

@sodevel
Copy link
Member

sodevel commented Feb 6, 2023

This is an assertion, in an C++ application this would popup a dialog, a Python application apparently gets terminated by this.

You used an invalid combination of sizer flags for an item inside that BoxSizer. Most probably you used alignment flags that affect the main layout direction of the sizer or you used any alignment flags together with wxEXPAND, this is not allowed. In the wxWidgets documentation you can find how to use sizer and how these flags work for different sizer types.

@tellts
Copy link
Author

tellts commented Feb 6, 2023

https://www.slideshare.net/UmarYusuf2/wxformbuilder-tutorial-on-a-gui-for-making-guis-for-python
On the page 9 it says "wxAlign_Center", And I chose the item: "wxAlign_Center_Horizontal". Probably due to the fact that this instruction is for an older version of the program and I did not know which item to choose correctly.
At the moment I need a hint what to choose in this box in order to be correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants