Get top level item of treelist selection

I’m using a wx.lib.agw.hypertreelist widget. The tree is only 1 or levels deep. If any item is selected (top level or children) I want to be able to delete all items from the top level down.

So I presume I need to find the top level item and delete all children.

Is there a convenient way to do that (or any other convenient approach)?

Is it possible to setup the widget so that only the top level (first level) of items are selectable and none of the children? That would make it easy.

Similarly is it possible to select all items from the first level down. e.g. if use selects an item at level 3, is there an easy way to programatically select all children of the parent item at level 1?

I’ve tried using GetSelection() and GetSelection() and they return None and [] respecitely (yes there are rows selected). How do I event use GetSelection()? There is nothing in the demo because it uses Bind() to setup event handlers, but I’m using a button handler to do some work.