aashish wrote:
Hi Robin,
Thank you for your quick and informative response ... based on your
information I got the problem solved... but I would like to share some of my
information here...Now previously what I was doing is like this.....
for x in variables:
self.mDatabaseTree.AppendItem(self.mTreeID[server][2], x)
self.mVariableMap[(server[0], server[3], server[4])] = ('',None,
None)
# self.mDatabaseTree.Expand(self.mTreeID[server][2])
self.mDatabaseTree.SortChildren(self.mTreeID[server][2])attaching the x to the the server[2] and then sorting .. here I was not
using the SetPyData() .. and then I got the error I sent to you ... (**this
just worked fine on the Linux**)for windows ....I did that after I got your mail .....
for x in variables:
child = self.mDatabaseTree.AppendItem(self.mTreeID[server][2], x)
"""SetPyData is required for adding the child to the tree"""
self.mDatabaseTree.SetPyData(child, None) self.mVariableMap[(server[0], server[3], server[4])] = ('',None,
None)
# self.mDatabaseTree.Expand(self.mTreeID[server][2])
self.mDatabaseTree.SortChildren(self.mTreeID[server][2])here I used none in SetPyData and then it worked fine....
now why that happened (did work on Linux and not on windows ?? )
Because the native control used on Windows requires that tree nodes have a data value in order to do sorting (yes I know that's silly, but that's the way it is.) The generic control used on Linux and Mac does not have that requirement.
also what
SetPyData does ?? and why is that (child, None) ??
It associates a Python object (None in this case) with a node in the tree.
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!