Bug in wxTreeListCtrl -> GetFirstChild exception

Calling wxTreeListCtrl.GetFirstChild() results in an exception.
To reproduce, edit wxTreeListCtrl.py in the demo and add the
following line after self.Tree.expand at the end of __init__

   child,cookie=self.tree.GetFirstChild(self.root,1234)

The exception is:

  File "C:\Python23\Lib\site-packages\wxPython\demo\wxTreeListCtrl.py", line 79, in runTest
    win = TestPanel(nb, log)
  File "C:\Python23\Lib\site-packages\wxPython\demo\wxTreeListCtrl.py", line 69, in __init__
    child,cookie=self.tree.GetFirstChild(self.root,0)
  File "C:\Python23\Lib\site-packages\wxPython\gizmos.py", line 653, in GetFirstChild
    val1,val2 = controls2c.wxTreeCtrl_GetFirstChild(self, *_args, **_kwargs)
TypeError: Type error in argument 1 of wxTreeCtrl_GetFirstChild. Expected _wxPyTreeCtrl_p.

Roger

Roger Binns wrote:

Calling wxTreeListCtrl.GetFirstChild() results in an exception.

I had the same problem some weeks ago. It is fixed in the current CVS.

Christian

Roger Binns wrote:
> Calling wxTreeListCtrl.GetFirstChild() results in an exception.

I had the same problem some weeks ago. It is fixed in the current CVS.

Any idea when the fix will be in a shipping version of wxPython?

I assume the only workaround is to maintain a duplicate tree structure
myself that retains the necessary information.

Roger

Roger Binns wrote:

Roger Binns wrote:

Calling wxTreeListCtrl.GetFirstChild() results in an exception.

I had the same problem some weeks ago. It is fixed in the current CVS.

Any idea when the fix will be in a shipping version of wxPython?

No. Maybe Robin Dunn will comment on this. I'm just a poor user... But if you don't want to get the whole CVS tree and if I remember right it's sufficient to update one file:

http://cvs.wxwindows.org/viewcvs.cgi/*checkout*/wxWindows/wxPython/contrib/gizmos/gizmos.py?rev=1.8.2.5

So at least you could play around with it before the next release of wxPython is out.

Christian

Roger Binns wrote:

Roger Binns wrote:

Calling wxTreeListCtrl.GetFirstChild() results in an exception.

I had the same problem some weeks ago. It is fixed in the current CVS.

Any idea when the fix will be in a shipping version of wxPython?

The next time I make a release, but I'm not sure yet when that will be.

I assume the only workaround is to maintain a duplicate tree structure
myself that retains the necessary information.

It was just a simple copy/paste error that shows up in a .py file, so as Christian mentions you can fix your copy just by getting the fixes from CVS in the file link posted. In fact, it is just a few lines from near the end of the file if you don't feel comfortable replacing hte whole thing.

···

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