GridBagSizer and AddGrowableRow()
Lindsay Haisley <[email protected]> Tue, 04 Feb 2020 22:00:17 -0600
| Newsgroups | gmane.comp.python.wxglade |
|---|---|
| Organization | FMP Computer Services |
| Message-ID | <[email protected]> |
It seem that when using a wx.GridBagSizer, setting AddGrowableRow() or AddGrowableCol() for a row or column which contains nothing will throw a Python invalid index error: Traceback (most recent call last): File "foo.py", line 67, in <module> app = MyApp(0) File "/usr/lib/python2.7/dist-packages/wx- 3.0-gtk3/wx/_core.py", line 8628, in __init__ self._BootstrapApp() File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk3/wx/_core.py", line 8196, in _BootstrapApp return _core_.PyApp__BootstrapApp(*args, **kwargs) File "foo.py", line 59, in OnInit self.frame = MyFrame(None, wx.ID_ANY, "") File "foo.py", line 27, in __init__ self.__do_layout() File "foo.py", line 48, in __do_layout grid_sizer_1.AddGrowableRow(2) File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk3/wx/_core.py", line 15343, in AddGrowableRow return _core_.FlexGridSizer_AddGrowableRow(*args, **kwargs)wx._core.PyAssertionError: C++ assertion "!m_rows || idx < (size_t)m_rows" failed at ../src/common/sizer.cpp(1967) in AddGrowableRow(): invalid row index If a widget is expanded into a row or column, as supported in a GridBagSizer, this counts for populating the rows and columns involved. Populating empty grid slots with blank panels will let the code run, which is probably the right way to solve this problem, but wxGlade should remove from the generated code any calls to AddGrowableRow() and/or AddGrowableCol() from rows or columns which have no content under this situation. If an unpopulated row or column is between populated rows or columns, the problem is avoided. Alternatively, something should be mentioned in the manual about this so that folks will have a heads-up about this problem. Simply putting something in every slot will avoid the issue, but wxGlade shouldn't ever generate code which throws this kind of error. Maybe this is a wxPython bug, I don't know. Sorry if this has been addressed before. I don't use wxGlade a lot and don't follow this mailing list very closely, but this situation bit me and it took me a while to troubleshoot it. -- Lindsay Haisley | "Humor will get you through times of no humor FMP Computer Services | better than no humor will get you through 512-259-1190 | times of humor." http://www.fmp.comom | - Butch Hancock _______________________________________________ wxGlade-general mailing list wxGlade-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/wxglade-general