setitem on column

Hi List,

I want to set a certain cell in a ListCtrl to Red. I am using the following
code to establish this:

                i = self.GetItem(self.n, colnr)
                self.SetItem(i.SetTextColour(wxRED))

However doing this gives me the following Traceback:

Traceback (most recent call last):
  File "/home/dick/CVix/CVix/src/ReportScrn.py", line 287, in OnReportSelected
    self.rapportenpanel.Tonen()
  File "/home/dick/CVix/CVix/src/ReportScrn.py", line 374, in Tonen
    self.list.UpdRecordset(data[1])
  File "/home/dick/CVix/CVix/src/DefColumns.py", line 1048, in UpdRecordset
    self.BldList(clear=True)
  File "/home/dick/CVix/CVix/src/DefColumns.py", line 647, in BldList
    self.ShowScrn = self.VulScherm()
  File "/home/dick/CVix/CVix/src/DefColumns.py", line 718, in VulScherm
    self.Vulrij(rec, self.n)
  File "/home/dick/CVix/CVix/src/DefColumns.py", line 796, in Vulrij
    listrij = self.VulSchermKolommen(rec, teller)
  File "/home/dick/CVix/CVix/src/DefColumns.py", line 810, in
VulSchermKolommen
    self.SetItem(i.SetTextColour(wxRED))
  File "/usr/lib/python2.4/site-packages/wxPython/controls2.py", line 471, in
SetItem
    val = controls2c.wxListCtrl_SetItem(self, *_args, **_kwargs)
TypeError: Type error in argument 2 of wxListCtrl_SetItem. Expected
_wxListItem_p.

I have been googling around, and I can't find anything that is giving me
directions here.

Cheers,
Dick Kniep

The call to i.SetTextColour(wxRED) returns None, since you are simply
setting the color of the item. So your second line is essentially
calling self.SetItem(None).

Try breaking up the steps:

                 i = self.GetItem(self.n, colnr)
                 i.SetTextColour(wxRED)
                 self.SetItem(i)

···

On 9/30/05, Dick Kniep <dick@kniep.nl> wrote:

I want to set a certain cell in a ListCtrl to Red. I am using the following
code to establish this:

                i = self.GetItem(self.n, colnr)
                self.SetItem(i.SetTextColour(wxRED))

--

# p.d.