wxListItem::SetTextColour causes field to disappear

I'm using 2.4.0.2 of wxPython. The attached code fails to display the the last column if I uncomment out the call to SetTextColour. Am I doing something wrong?

···

===========================================================
from wxPython.wx import *

class Fail(wxFrame):

  def __init__(self, parent):
    wxFrame.__init__(self, parent, -1, "Fail")

    self.theList = wxListCtrl(self, -1,
      wxDefaultPosition, wxDefaultSize,
      wxLC_REPORT)
    self.theList.InsertColumn(0, "Record No")
    self.theList.InsertColumn(1, "Data")
    self.theList.InsertStringItem(0, "0001")

    i = wxListItem()
    i.SetText("00 01 02 03 04 FF EE DD")
    i.SetColumn(1)
    i.SetId(0)
    i.SetMask(wxLIST_MASK_TEXT)
    # i.SetTextColour(wxNamedColour("BLUE"))
    self.theList.SetItem(i)

  def OnExit(self, event):
    self.Destroy()

if __name__ == "__main__":
  app = wxPySimpleApp()
  frame = Fail(None)
  frame.Show(true)
  app.SetTopWindow(frame)
  app.MainLoop()

--
Mark Wright
mwright@pro-ns.net

Mark Wright wrote:

I'm using 2.4.0.2 of wxPython. The attached code fails to display the the last column if I uncomment out the call to SetTextColour. Am I doing something wrong?

You don't mention the platform so I don't know for sure what is happening, but I do know that you can only set the colour for the whole item, not individual columns. Try

  self.theList.SetItemTextColour(0, "BLUE")

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!