Here’s the error:
self.middleSplitter.myUltimateList.SetColumnWidth(1, wx.LIST_AUTOSIZE)
File “C:\MyProject\ThirdParty\Portable Python 2.7.5.1\App\lib\site-packages\wx-2.9.4-msw\wx\lib\agw\ultimatelistctrl.py”, line 11254, in SetColumnWidth
self._mainWin.SetColumnWidth(col, width)
File “C:\MyProject\ThirdParty\Portable Python 2.7.5.1\App\lib\site-packages\wx-2.9.4-msw\wx\lib\agw\ultimatelistctrl.py”, line 8699, in SetColumnWidth
item = itemData.GetItem(item)
File “C:\MyProject\ThirdParty\Portable Python 2.7.5.1\App\lib\site-packages\wx-2.9.4-msw\wx\lib\agw\ultimatelistctrl.py”, line 3165, in GetItem
if self._attr.HasTextColour():
File “C:\MyProject\ThirdParty\Portable Python 2.7.5.1\App\lib\site-packages\wx-2.9.4-msw\wx\lib\agw\ultimatelistctrl.py”, line 1253, in HasTextColour
return self._colText.Ok()
AttributeError: ‘str’ object has no attribute ‘Ok’
I get this after
item1 = self.middleSplitter.myUltimateList.GetItem(rowIndex, 1)
item1.SetTextColour(‘red’)
self.middleSplitter.myUltimateList.SetItem(item1)
but not if I do
item1 = self.middleSplitter.myUltimateList.GetItem(rowIndex, 1)
item1.SetTextColour(wx.Colour(255,0,0))
self.middleSplitter.myUltimateList.SetItem(item1)
I added some print statements in ultimatelistctrl.py in the function HasTextColour
def HasTextColour(self):
""" Returns ``True`` if the currently set text colour is valid. """
print self._colText
print type(self._colText)
return self._colText.Ok()
and indeed see a difference between ‘red’ and wx.Colour(255,0,0)
red
<type ‘str’>
Traceback (most recent call last):
File "c:\Users\nmccorkx\Portable_Python_2.7.5.1_gtk\App\lib\site-packages\wx-2
.9.4-msw\wx\lib\agw\ultimatelistctrl.py", line 7497, in OnMouse
newItem, hitResult = self.HitTestLine(current, x, y)
File "c:\Users\nmccorkx\Portable_Python_2.7.5.1_gtk\App\lib\site-packages\wx-2
.9.4-msw\wx\lib\agw\ultimatelistctrl.py", line 6809, in HitTestLine
newItem = self.GetParent().GetItem(line, col)
File "c:\Users\nmccorkx\Portable_Python_2.7.5.1_gtk\App\lib\site-packages\wx-2
.9.4-msw\wx\lib\agw\ultimatelistctrl.py", line 11279, in GetItem
return self._mainWin.GetItem(item, col)
File "c:\Users\nmccorkx\Portable_Python_2.7.5.1_gtk\App\lib\site-packages\wx-2
.9.4-msw\wx\lib\agw\ultimatelistctrl.py", line 9008, in GetItem
item = line.GetItem(col, item)
File "c:\Users\nmccorkx\Portable_Python_2.7.5.1_gtk\App\lib\site-packages\wx-2
.9.4-msw\wx\lib\agw\ultimatelistctrl.py", line 4109, in GetItem
return item.GetItem(info)
File "c:\Users\nmccorkx\Portable_Python_2.7.5.1_gtk\App\lib\site-packages\wx-2
.9.4-msw\wx\lib\agw\ultimatelistctrl.py", line 3166, in GetItem
if self._attr.HasTextColour():
File "c:\Users\nmccorkx\Portable_Python_2.7.5.1_gtk\App\lib\site-packages\wx-2
.9.4-msw\wx\lib\agw\ultimatelistctrl.py", line 1254, in HasTextColour
return self._colText.Ok()
AttributeError: ‘str’ object has no attribute ‘Ok’
vs (when I use a wx.Colour)
(-1, -1, -1, 255)
<class ‘wx._gdi.Colour’>