Hi,
I have this function, which receives an empty wx.Grid (in panel), and
is supposed to fill some cells on this grid:
def display_program_banner(self, panel):
print(". type(panel):",type(panel))
print(". panel.__dict__:",panel.__dict__)
number_rows = panel.GetNumberRows()
number_cols = panel.GetNumberCols()
print(". number_rows:",number_rows)
print(". number_cols:",number_cols)
panel.AppendRows(4)
panel.AppendCols(1)
panel.SetCellValue(0,0,"svm_ts_tool")
panel.SetCellValue(1,0,"Version 1.0")
panel.SetCellValue(2,0,"DPM1 save_state date")
panel.SetCellValue(3,0,"DPM2 save_state date")
panel.AutoSize()
panel.SetColLabelSize(0)
panel.SetRowLabelSize(0)
panel.Show(True)
However, I get the following error on the bolded line:
('. type(panel):', <class 'wx.grid.Grid'>)
('. panel.__dict__:', {'this': <Swig Object of type 'wxGrid *' at
0x355b1d8>})
('. number_rows:', 0)
('. number_cols:', 0)
Traceback (most recent call last):
File "svm_ts_tool_in_progress.py", line 319, in OnSelChanged
self.TreeViewController(self.tablecont)
File "svm_ts_tool_in_progress.py", line 442, in TreeViewController
self.TableViewController(req_table)
File "svm_ts_tool_in_progress.py", line 1455, in TableViewController
self.display_program_banner(self.table)
File "svm_ts_tool_in_progress.py", line 1466, in
display_program_banner
panel.AppendRows(4)
File "c:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\grid.py",
line 1221, in AppendRows
return _grid.Grid_AppendRows(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "wxAssertFailure" failed at ..
\..\src\generic\grid.cpp(6713) in wxGrid::AppendRows(): Called
wxGrid::AppendRows() before calling CreateGrid()
Why is wxPython asking me to call CreateGrid() when the grid I'm
working on (panel) already exists ?
Thanks,
Ron.