Dear wxPython Users,
I'm having a problem with my subclass of wx.TreeCtrl (I'm using the new naming scheme). The code works on Linux and OS X, but fails on WinXP with the following assertion failure:
File "C:\Python23\Lib\site-packages\wxPython\controls2.py", line 1012, in SetPyData
val = controls2c.wxTreeCtrl_SetPyData(self, *_args, **_kwargs)
wxPython.wxc.wxPyAssertionError: C++ assertion "wxAssertFailure" failed in e:\Projects\wx2.4\src\msw\treectrl.cpp(750):
can't retrieve virtual root item
Any thoughts?
Thanks in advance,
Michael Stone
The relevant versions are, on Linux:
Python 2.2.3
wxGTK 2.4.1
wxPython 2.4.1.2
and on Windows:
Python 2.3.2
wxWindows 2.4.2
wxPython 2.4.2.4
The code in question is:
def Populate(self, collection = None, root = None):
if collection == None:
collection = Model.ProtocolManager()
if root == None:
self.DeleteAllItems()
root = self.AddRoot(collection.GetName())
self.SetPyData(root, collection) #<<<<======= the code fails here.
############ collection.GetName() and root seem valid.
else:
self.DeleteChildren(root)
for child in collection.GetChildren():
assert isinstance(child, Model.NamedObject)
childNode = self.AppendItem(root, child.GetName())
self.SetPyData(childNode, child)
if isinstance(child, Model.Collection):
self.Populate(child, childNode)
else:
print "Child is not a collection!"
assert False