TreeExpander

class TreeExpander(**properties: Any)

Superclasses: Widget, InitiallyUnowned, Object

Implemented Interfaces: Accessible, Buildable, ConstraintTarget

Constructors:

TreeExpander(**properties)
new() -> Gtk.Widget

Constructors

class TreeExpander
classmethod new() Widget

Creates a new GtkTreeExpander

Methods

class TreeExpander
get_child() Widget | None

Gets the child widget displayed by self.

get_hide_expander() bool

Gets whether the TreeExpander should be hidden in a GtkTreeListRow.

Added in version 4.10.

get_indent_for_depth() bool

TreeExpander indents each level of depth with an additional indent.

Added in version 4.10.

get_indent_for_icon() bool

TreeExpander indents the child by the width of an expander-icon if it is not expandable.

Added in version 4.6.

get_item() Object | None

Forwards the item set on the GtkTreeListRow that self is managing.

This call is essentially equivalent to calling:

gtk_tree_list_row_get_item (gtk_tree_expander_get_list_row (``self``));
get_list_row() TreeListRow | None

Gets the list row managed by self.

set_child(child: Widget | None = None) None

Sets the content widget to display.

Parameters:

child – a GtkWidget

set_hide_expander(hide_expander: bool) None

Sets whether the expander icon should be visible in a GtkTreeListRow.

Added in version 4.10.

Parameters:

hide_expander – TRUE if the expander should be hidden. Otherwise FALSE.

set_indent_for_depth(indent_for_depth: bool) None

Sets if the TreeExpander should indent the child according to its depth.

Added in version 4.10.

Parameters:

indent_for_depth – TRUE if the child should be indented. Otherwise FALSE.

set_indent_for_icon(indent_for_icon: bool) None

Sets if the TreeExpander should indent the child by the width of an expander-icon when it is not expandable.

Added in version 4.6.

Parameters:

indent_for_icon – TRUE if the child should be indented without expander. Otherwise FALSE.

set_list_row(list_row: TreeListRow | None = None) None

Sets the tree list row that this expander should manage.

Parameters:

list_row – a GtkTreeListRow

Properties

class TreeExpander
props.child: Widget

The child widget with the actual contents.

props.hide_expander: bool

Whether the expander icon should be hidden in a GtkTreeListRow. Note that this property simply hides the icon. The actions and keybinding (i.e. collapse and expand) are not affected by this property.

A common use for this property would be to bind to the number of children in a GtkTreeListRow’s model in order to hide the expander when a row has no children.

Added in version 4.10.

props.indent_for_depth: bool

TreeExpander indents the child according to its depth.

Added in version 4.10.

props.indent_for_icon: bool

TreeExpander indents the child by the width of an expander-icon if it is not expandable.

Added in version 4.6.

props.item: Object

The item held by this expander’s row.

props.list_row: TreeListRow

The list row to track for expander state.