TreePath#

Deprecated since version 4.10: Please do not use it in newly written code

class TreePath(*args, **kwargs)#

An opaque structure representing a path to a row in a model.

Constructors#

class TreePath
classmethod new() TreePath#

Creates a new GtkTreePath This refers to a row.

Deprecated since version 4.10: Please do not use it in newly written code

classmethod new_first() TreePath#

Creates a new GtkTreePath.

The string representation of this path is “0”.

Deprecated since version 4.10: Please do not use it in newly written code

classmethod new_from_indices(indices: Sequence[int]) TreePath#

Creates a new path with first_index and varargs as indices.

Deprecated since version 4.10: Please do not use it in newly written code

Parameters:

indices

classmethod new_from_string(path: str) TreePath | None#

Creates a new GtkTreePath initialized to path.

path is expected to be a colon separated list of numbers. For example, the string “10:4:0” would create a path of depth 3 pointing to the 11th child of the root node, the 5th child of that 11th child, and the 1st child of that 5th child. If an invalid path string is passed in, None is returned.

Deprecated since version 4.10: Please do not use it in newly written code

Parameters:

path – The string representation of a path

Methods#

class TreePath
append_index(index_: int) None#

Appends a new index to a path.

As a result, the depth of the path is increased.

Deprecated since version 4.10: Please do not use it in newly written code

Parameters:

index – the index

compare(b: TreePath) int#

Compares two paths.

If a appears before b in a tree, then -1 is returned. If b appears before a, then 1 is returned. If the two nodes are equal, then 0 is returned.

Deprecated since version 4.10: Please do not use it in newly written code

Parameters:

b – a GtkTreePath to compare with

down() None#

Moves path to point to the first child of the current path.

Deprecated since version 4.10: Please do not use it in newly written code

free() None#

Frees path. If path is None, it simply returns.

Deprecated since version 4.10: Please do not use it in newly written code

get_depth() int#

Returns the current depth of path.

Deprecated since version 4.10: Please do not use it in newly written code

get_indices() list[int] | None#

Returns the current indices of path.

This is an array of integers, each representing a node in a tree. This value should not be freed.

The length of the array can be obtained with get_depth().

Deprecated since version 4.10: Please do not use it in newly written code

is_ancestor(descendant: TreePath) bool#

Returns True if descendant is a descendant of path.

Deprecated since version 4.10: Please do not use it in newly written code

Parameters:

descendant – another GtkTreePath

is_descendant(ancestor: TreePath) bool#

Returns True if path is a descendant of ancestor.

Deprecated since version 4.10: Please do not use it in newly written code

Parameters:

ancestor – another GtkTreePath

next() None#

Moves the path to point to the next node at the current depth.

Deprecated since version 4.10: Please do not use it in newly written code

prepend_index(index_: int) None#

Prepends a new index to a path.

As a result, the depth of the path is increased.

Deprecated since version 4.10: Please do not use it in newly written code

Parameters:

index – the index

prev() bool#

Moves the path to point to the previous node at the current depth, if it exists.

Deprecated since version 4.10: Please do not use it in newly written code

to_string() str | None#

Generates a string representation of the path.

This string is a “:” separated list of numbers. For example, “4:10:0:3” would be an acceptable return value for this string. If the path has depth 0, None is returned.

Deprecated since version 4.10: Please do not use it in newly written code

up() bool#

Moves the path to point to its parent node, if it has a parent.

Deprecated since version 4.10: Please do not use it in newly written code