My program consists of a main screen and a wx.grid child screen. The
wx.grid is approx 50 rows by 17 columns. Each grid cell is formatted
using GridCellAttr with various combinations of attr.SetReadOnly,
attr.SetFont, attr.SetAlignment, attr.SetRenderer, and
attr.SetEditor. Looking back, using SetRowAttr and SetColAttr instead
of GridCellAttr may have been a better approach.
The wx.grid child window does exactly what I need it to do. However,
on occasion, when I exit the wx.grid child window, python crashes. I
do not have a good clue to solve this problem. I have tried hiding the
child windows before calling destroy but still no luck. I have been
reading about calling “IncRef() as a possible solution. In short,
each time I assign a GridCellAttr, call .IncRef().
Does calling IncRef() make sense and solve python crashing problem?
Yes. Basically any time you use the same attr, GridCellRenderer or GridCellEditor instance in more than one place you should have an extra IncRef. That will help prevent it from being destroyed while some other object may still be using it.
···
On 7/7/12 1:24 PM, bruce g wrote:
wxPython users,
My program consists of a main screen and a wx.grid child screen. The
wx.grid is approx 50 rows by 17 columns. Each grid cell is formatted
using GridCellAttr with various combinations of attr.SetReadOnly,
attr.SetFont, attr.SetAlignment, attr.SetRenderer, and
attr.SetEditor. Looking back, using SetRowAttr and SetColAttr instead
of GridCellAttr may have been a better approach.
The wx.grid child window does exactly what I need it to do. However,
on occasion, when I exit the wx.grid child window, python crashes. I
do not have a good clue to solve this problem. I have tried hiding the
child windows before calling destroy but still no luck. I have been
reading about calling �IncRef() as a possible solution. In short,
each time I assign a GridCellAttr, call .IncRef().
Does calling IncRef() make sense and solve python crashing problem?