Skip to content

Gtk.TreePath

record (struct)

:::warning Deprecated since 4.10 This API is deprecated. :::

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

Constructors

new

@classmethod
def new(cls) -> TreePath

:::warning Deprecated since 4.10 This API is deprecated. :::

Creates a new GtkTreePath This refers to a row.

new_first

@classmethod
def new_first(cls) -> TreePath

:::warning Deprecated since 4.10 This API is deprecated. :::

Creates a new GtkTreePath.

The string representation of this path is “0”.

new_from_indicesv

@classmethod
def new_from_indicesv(cls, indices: list[int]) -> TreePath

:::warning Deprecated since 4.10 This API is deprecated. :::

Creates a new path with the given indices array of length.

Parameters:

  • indices — array of indices

new_from_string

@classmethod
def new_from_string(cls, path: str) -> TreePath | None

:::warning Deprecated since 4.10 This API is deprecated. :::

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.

Parameters:

  • path — The string representation of a path

Methods

append_index

def append_index(self, index_: int) -> None

:::warning Deprecated since 4.10 This API is deprecated. :::

Appends a new index to a path.

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

Parameters:

  • index_ — the index

compare

def compare(self, b: TreePath) -> int

:::warning Deprecated since 4.10 This API is deprecated. :::

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.

Parameters:

  • b — a GtkTreePath to compare with

copy

def copy(self) -> TreePath

:::warning Deprecated since 4.10 This API is deprecated. :::

Creates a new GtkTreePath as a copy of path.

down

def down(self) -> None

:::warning Deprecated since 4.10 This API is deprecated. :::

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

free

def free(self) -> None

:::warning Deprecated since 4.10 This API is deprecated. :::

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

get_depth

def get_depth(self) -> int

:::warning Deprecated since 4.10 This API is deprecated. :::

Returns the current depth of path.

get_indices

def get_indices(self) -> list[int] | None

:::warning Deprecated since 4.10 This API is deprecated. :::

Returns the current indices of path.

This is an array of integers, each representing a node in a tree. It also returns the number of elements in the array. The array should not be freed.

is_ancestor

def is_ancestor(self, descendant: TreePath) -> bool

:::warning Deprecated since 4.10 This API is deprecated. :::

Returns True if descendant is a descendant of path.

Parameters:

  • descendant — another GtkTreePath

is_descendant

def is_descendant(self, ancestor: TreePath) -> bool

:::warning Deprecated since 4.10 This API is deprecated. :::

Returns True if path is a descendant of ancestor.

Parameters:

  • ancestor — another GtkTreePath

next

def next(self) -> None

:::warning Deprecated since 4.10 This API is deprecated. :::

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

prepend_index

def prepend_index(self, index_: int) -> None

:::warning Deprecated since 4.10 This API is deprecated. :::

Prepends a new index to a path.

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

Parameters:

  • index_ — the index

prev

def prev(self) -> bool

:::warning Deprecated since 4.10 This API is deprecated. :::

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

to_string

def to_string(self) -> str | None

:::warning Deprecated since 4.10 This API is deprecated. :::

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.

up

def up(self) -> bool

:::warning Deprecated since 4.10 This API is deprecated. :::

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