Tree (hwx.gui)

Hierarchical list of items.



Public Methods

add (self, parent=None, text=None, **kwds)
clear (self)
collapseAll (self)
ensureItemVisible (self, item)
expandAll (self, expanded=True)
get (self)
getChildren (self, parent=None)
getSelected (self)
remove (self, item)
setSelected (self, items, selected=True, clear=True)

Property Details


The selection mode. Valid choices are:

  • “single”
  • “extended”
  • “multi”
  • “contiguous”
  • “none”

Method Details

add(self, parent=None, text=None, **kwds)

Adds a TreeItem to the Tree.

param parent:A TreeItem to define hierarchy.
type parent:TreeItem, optional
param text:The text that gets displayed.
type text:str, optional
returns:the added TreeItem.

Removes all items from the tree.


Collapses all items.

ensureItemVisible(self, item)

Scrolls view so this item is visible.

param item:TreeItem to make visible.
type item:TreeItem
expandAll(self, expanded=True)

Expands (or collapses) all items.

param expanded:Determines whether to expand or not.
type expanded:bool, optional

Returns the current selected item.

getChildren(self, parent=None)

Overloaded Widget method for ‘children’ property.


Returns a list of the selected items.

remove(self, item)

Removes the specified item from the tree.

param item:Item to be removed.
type item:TreeItem
setSelected(self, items, selected=True, clear=True)

Selects the specified items.

param items:list of TreeItems to be selected.
type items:list[TreeItems]
param selected:Determines if items will be selected or not.
type selected:bool, optional
param clear:Determines if al previously selected items will be cleared or not.
type clear:bool, optional