error in traverse treeCtrl

Hi,

I have wx.treeCtrl and following method which change image of the item.

def changeImageSuccess(self,text =“None”):

node = self.GetSelection()

if self.ItemHasChildren(node):

item,cookie = self.GetFirstChild(node,0)

while item.isOK():

print self.GetItemText(item)

if self.GetItemText(item) == text:

self.SetItemImage(item, “\image”, wx.TreeItemIcon_Normal)

item,cookie =self.GetNextChild(item, cookie)

else:

self.SetItemImage(self.selectedItem, “\image”, wx.TreeItemIcon_Normal)

Traceback (most recent call last):

File “/home/Set.py”, line 78, in changeImageSuccess

item,cookie = self.GetFirstChild(node,0)

File “/home/Python-2.7/lib/python2.7/site-packages/wxPython-src-3.0.0.0/wxPython/wx/_controls.py”, line 5389, in GetFirstChild

return controls.TreeCtrl_GetFirstChild(*args, **kwargs)

TypeError: TreeCtrl_GetFirstChild() takes at most 2 arguments (3 given)

Thanks and Regards

Hemadri

The error is simple, you are calling the method with too many parameters, the docs:
http://wxpython.org/Phoenix/docs/html/TreeCtrl.html#TreeCtrl.GetFirstChild

GetFirstChild(self, item)

Just get rid of that 0.

···

On Sunday, November 2, 2014 7:53:50 AM UTC-8, Hemadri Saxena wrote:

Hi,

I have wx.treeCtrl and following method which change image of the item.

def changeImageSuccess(self,text =“None”):

node = self.GetSelection()

if self.ItemHasChildren(node):

item,cookie = self.GetFirstChild(node,0)

Hi,

It worked…Thanks …I was referring to http://docs.wxwidgets.org/trunk/classwx_tree_ctrl.html

Thanks

···

On Mon, Nov 3, 2014 at 3:04 AM, Nathan McCorkle nmz787@gmail.com wrote:

On Sunday, November 2, 2014 7:53:50 AM UTC-8, Hemadri Saxena wrote:

Hi,

I have wx.treeCtrl and following method which change image of the item.

def changeImageSuccess(self,text =“None”):

node = self.GetSelection()

if self.ItemHasChildren(node):

item,cookie = self.GetFirstChild(node,0)

The error is simple, you are calling the method with too many parameters, the docs:
http://wxpython.org/Phoenix/docs/html/TreeCtrl.html#TreeCtrl.GetFirstChild

GetFirstChild(self, item)

Just get rid of that 0.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Thanks and Regards
Hemadri Saxena
9086087510

That is not describing wxPython. Here is the older version of the docs, it also lists only 1 non-self argument:

http://www.wxpython.org/docs/api/wx.TreeCtrl-class.html

···

On Monday, November 3, 2014 8:57:14 AM UTC-8, Hemadri Saxena wrote:

Hi,

It worked…Thanks …I was referring to http://docs.wxwidgets.org/trunk/classwx_tree_ctrl.html