I'm trying to make loop over columns of a wxGrid object, where in each
loop I build a wxGridCellAttr with differents fonts and colours and I
call SetCollAttr method. I don't know why this fail in an iteration (not
always the same). It's not an controled exception but windows throws a
memory error.
What I try to do is something like this (well a bit more
complicated...):
grid = wxGrid(self)
grid.CreateGrid(5,5)
colors = [wxWHITE,wxBLACK,wxLIGHT_GREY,wxRED,wxBLUE]
for col in xrange(5):
attr = wxGridCellAttr()
attr.SetTextColour(colors[col])
attr.SetBackgroundColour(colors[col])
grid.SetColAttr(col,attr)
If somebody knows what's happening with this piece of code please reply
me. Thanks
I thought it should be doing it interally, but try calling attr.IncRef()
···
spalomin.madrid@sinvest.es wrote:
I have got a problem whith wxGridCellAttr object.
I'm trying to make loop over columns of a wxGrid object, where in each
loop I build a wxGridCellAttr with differents fonts and colours and I
call SetCollAttr method. I don't know why this fail in an iteration (not
always the same). It's not an controled exception but windows throws a
memory error.
What I try to do is something like this (well a bit more
complicated...):
grid = wxGrid(self)
grid.CreateGrid(5,5)
colors = [wxWHITE,wxBLACK,wxLIGHT_GREY,wxRED,wxBLUE]
for col in xrange(5):
attr = wxGridCellAttr()
attr.SetTextColour(colors[col])
attr.SetBackgroundColour(colors[col])
grid.SetColAttr(col,attr)
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!