[ANN] wxPyPlot V1.1 Beta 1

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.

Hi there,

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'

Does anybody know why?

Thanks in advance,
Rob

sorry, I see what's wrong.. the recursion is stopped but the
final return value is empty because it uses the first recursion depth.

Sorry for troubling you,
Rob

Echeverria Rabi, Cristián wrote:

It's great!
Any plan to include it into the next release of wxPython?

It's been discussed. I'm just waiting for the go ahead and the samples to drop into the demo.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

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'

Your recursive function doesn't return anything unless
self.tree.GetItemText(item) == itemtext in the very first line.
-Rick King