TTkTreeWidgetItem🌶️

class TTkTreeWidgetItem(*args, parent: TTkTreeWidgetItem | None = None, expanded: bool = False, hidden: bool = False, icon: str | TTkString = '', childIndicatorPolicy: ChildIndicatorPolicy = ChildIndicatorPolicy.DontShowIndicatorWhenChildless, **kwargs)[source]🌶️

Bases: TTkAbstractItemModel

The TTkTreeWidgetItem class provides an item for use with the :py:class:’TTkTree’ convenience class.

Tree widget items are used to hold rows of information for tree widgets. Rows usually contain several columns of data, each of which can contain a TTkString label and an icon or a TTkWidget.

Items are usually constructed with a parent that is TTkTreeWidgetItem (for items on lower levels of the tree). For example, the following code constructs a top-level item to represent cities of the world, and adds a entry for Oslo as a child item:

cities = TTkWidgetItem(["Cities"])
osloItem = TTkWidgetItem(["Oslo"], parent=cities)

or

cities = TTkWidgetItem(["Cities"])
osloItem = TTkWidgetItem(["Oslo"]
cities.addChild(osloItem)

Slots🌶️

Methods🌶️

addChild(child: TTkTreeWidgetItem) → None[source]🌶️
addChildren(children: List[TTkTreeWidgetItem]) → None[source]🌶️
child(index: int) → TTkTreeWidgetItem | None[source]🌶️
childIndicatorPolicy() → ChildIndicatorPolicy[source]🌶️
children() → List[TTkTreeWidgetItem][source]🌶️
collapseAll() → None[source]🌶️
data(col: int, role: Any = None) → TTkString[source]🌶️
emitDataChanged() → None[source]🌶️
expandAll() → None[source]🌶️
hasWidgets()[source]🌶️
height()[source]🌶️
icon(col: int) → TTkString[source]🌶️
indexOfChild(child: TTkTreeWidgetItem) → int[source]🌶️
isExpanded() → bool[source]🌶️
isHidden() → bool[source]🌶️
removeChild(child: TTkTreeWidgetItem) → None[source]🌶️
setChildIndicatorPolicy(policy: ChildIndicatorPolicy) → None[source]🌶️
setExpanded(expand: bool) → None[source]🌶️
setHidden(hide: bool) → None[source]🌶️
setIcon(col: int, icon: str | TTkString) → None[source]🌶️
setTextAlignment(col: int, alignment: Alignment) → None[source]🌶️
size() → int[source]🌶️
sortChildren(col: int, order: SortOrder) → None[source]🌶️
takeChild(index: int) → TTkTreeWidgetItem | None[source]🌶️
takeChildren() → List[TTkTreeWidgetItem][source]🌶️
textAlignment(col: int) → Alignment[source]🌶️
widget(col: int, role: Any = None) → TTkWidget | None[source]🌶️

TTkTreeWidgetItem Attributes🌶️

dataChanged

heightChanged