What does the wxTreeCtrl.GetItemParent() parent return for the root
item? Or in other words, if I'm climbing up the tree with a loop like
item = self.tree.GetSelection()
while <not_at_root>:
if some_condition(item):
break
item = tree.GetItemParent(item)
The question then is what condition to use for <not_at_root>.
I would expect GetItemParent to return None when item doesn't have a
parent so that the I could use e.g. "while item is not None" or simply
"while item". The wxWindows/wxPython documentation doesn't say anything
at all about this boundary case of GetItemParent.
Bernhard
···
--
Intevation GmbH http://intevation.de/
Sketch http://sketch.sourceforge.net/
MapIt! http://mapit.de/
This could make it
root = tree.GetRootItem()
while item != root:
Raul
Bernhard Herzog wrote:
···
What does the wxTreeCtrl.GetItemParent() parent return for the root
item? Or in other words, if I'm climbing up the tree with a loop like
item = self.tree.GetSelection()
while <not_at_root>:
if some_condition(item):
break
item = tree.GetItemParent(item)
The question then is what condition to use for <not_at_root>.
I would expect GetItemParent to return None when item doesn't have a
parent so that the I could use e.g. "while item is not None" or simply
"while item". The wxWindows/wxPython documentation doesn't say anything
at all about this boundary case of GetItemParent.
Bernhard
--
Intevation GmbH http://intevation.de/
Sketch http://sketch.sourceforge.net/
MapIt! http://mapit.de/
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users
Raul Cota <cota@ucalgary.ca> writes:
This could make it
root = tree.GetRootItem()
while item != root:
That might work too. In the meantime I've had a look at the sources and
found that the items have a method IsOk() and that I can use "while
item.IsOk()".
Bernhard
···
--
Intevation GmbH http://intevation.de/
Sketch http://sketch.sourceforge.net/
MapIt! http://mapit.de/