SetItemHasChildren() for TreeListCtrl ?

20 views
Skip to first unread message

Philippe F

unread,
Sep 20, 2017, 4:59:16 PM9/20/17
to wxPython-users
Dear wx users,

With the release of Phoenix, I can now work on my favorite hobby: porting the respectable Winpdb debugger to Python 3 / WxPython 4 (see https://github.com/bluebird75/winpdb if you are interested). It was initially written for WxPython 2.6 so it's quite a fast forward !

Winpdb uses TreeListCtrl and fails when looking for the method: SetItemHasChildren() . I chedked the 2.6 documentation and this is for forcing the display of the expansion symbol, so that the user can expand the item, and the program can lazily calculate the children list.

Is there an equivalent in WxPython 4 ? I saw a SetItemHasChildren() in wx.TreeCtrl but nothing similar for TreeListCtrl...

Thanks in advance,

Philippe F.

Robin Dunn

unread,
Sep 20, 2017, 5:27:16 PM9/20/17
to wxPython-users
The new wx.dataview.TreeListCtrl is not the same class as the old wx.gizmos.TreeListCtrl. Rather it is just a very simplistic layer on top of the DataViewCtrl with a built-in data model. The classes in the wx.gizmos module hasn't been ported to Phoenix yet, and if it is I think I would rather have it as Python code instead of wrapped C++ code.

Due to being just a thin layer the wx.dataview.TreeListCtrl doesn't support "virtual" data via SetItemHasChildren like the old TreeListCtrl or wx.TreeCtrl, but the underlying DataViewCtrl does and is a lot more flexible. So you may want to look into switching to a DataViewCtrl with a custom DataViewModel for holding or generating the data to be displayed.  There is also AGW's HyperTreeList class.


Robin
Reply all
Reply to author
Forward
0 new messages