It's great!
Any plan to include it into the next release of wxPython?
···
-----Original Message-----
From: Gordon Williams [mailto:g_will@cyberus.ca]
Sent: Monday, June 02, 2003 8:26 PM
To: wxPython List
Subject: [wxPython-users] [ANN] wxPyPlot V1.1 Beta 1
Hi All,
I have released Version 1.1 beta 1 of wxPyPlot for producing simple plots
in wxPython.
I wrote a recursive function that walks through all the branches of
a tree looking for a specific text. If the text is found the item
should be the return value.
This is my code:
def GetTreeItem( self, item, itemtext ):
if self.tree.GetItemText(item) == itemtext: #if succesful item is a value ('print' says it is assigned to a wxTreeItem)
return item
cookie = 0
if self.tree.ItemHasChildren( item ):
for i in range( 0, self.tree.GetChildrenCount( item, false )):
if i==0:
(child, cookie) = self.tree.GetFirstChild(item, cookie)
else:
(child, cookie) = self.tree.GetNextChild(item, cookie)
self.GetTreeItem( child, itemtext )
and here is some code that uses the function:
def UpdateSoiltypesTree(self):
i = self.GetTreeItem( self.tree.GetRootItem(), "Soil" )
print i #somehow i = None, even if 'Soil' is a valid itemtext that is found ??
now to the strange part. If I call this function the value of item in GetTreeItem is
assigned to a wxTreeItem if the function succeeds so I expected it to be present
in 'i' in UpdateSoiltypesTree. However.. the returnvalue always seems to be 'None'