Gtk.TreePath

Fields

None

Methods

class

new ()

class

new_first ()

class

new_from_indices (indices)

class

new_from_string (path)

append_index (index_)

compare (b)

copy ()

down ()

free ()

get_depth ()

get_indices ()

is_ancestor (descendant)

is_descendant (ancestor)

next ()

prepend_index (index_)

prev ()

to_string ()

up ()

Details

class Gtk.TreePath(*args, **kwargs)

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

classmethod new()[source]
Returns:

A newly created GtkTreePath.

Return type:

Gtk.TreePath

Creates a new GtkTreePath This refers to a row.

Deprecated since version 4.10.

classmethod new_first()[source]
Returns:

A new GtkTreePath

Return type:

Gtk.TreePath

Creates a new GtkTreePath.

The string representation of this path is “0”.

Deprecated since version 4.10.

classmethod new_from_indices(indices)[source]
Parameters:

indices ([int]) – array of indices

Returns:

A newly created GtkTreePath

Return type:

Gtk.TreePath

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

Deprecated since version 4.10.

classmethod new_from_string(path)[source]
Parameters:

path (str) – The string representation of a path

Returns:

A newly-created GtkTreePath

Return type:

Gtk.TreePath or 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.

append_index(index_)[source]
Parameters:

index (int) – the index

Appends a new index to a path.

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

Deprecated since version 4.10.

compare(b)[source]
Parameters:

b (Gtk.TreePath) – a GtkTreePath to compare with

Returns:

the relative positions of self and b

Return type:

int

Compares two paths.

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

Deprecated since version 4.10.

copy()[source]
Returns:

a new GtkTreePath

Return type:

Gtk.TreePath

Creates a new GtkTreePath as a copy of self.

Deprecated since version 4.10.

down()[source]

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

Deprecated since version 4.10.

free()[source]

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

Deprecated since version 4.10.

get_depth()[source]
Returns:

The depth of self

Return type:

int

Returns the current depth of self.

Deprecated since version 4.10.

get_indices()[source]
Returns:

The current indices

Return type:

[int] or None

Returns the current indices of self.

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.

Deprecated since version 4.10.

is_ancestor(descendant)[source]
Parameters:

descendant (Gtk.TreePath) – another GtkTreePath

Returns:

True if descendant is contained inside self

Return type:

bool

Returns True if descendant is a descendant of self.

Deprecated since version 4.10.

is_descendant(ancestor)[source]
Parameters:

ancestor (Gtk.TreePath) – another GtkTreePath

Returns:

True if ancestor contains self somewhere below it

Return type:

bool

Returns True if self is a descendant of ancestor.

Deprecated since version 4.10.

next()[source]

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

Deprecated since version 4.10.

prepend_index(index_)[source]
Parameters:

index (int) – the index

Prepends a new index to a path.

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

Deprecated since version 4.10.

prev()[source]
Returns:

True if self has a previous node, and the move was made

Return type:

bool

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

Deprecated since version 4.10.

to_string()[source]
Returns:

A newly-allocated string

Return type:

str or 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.

up()[source]
Returns:

True if self has a parent, and the move was made

Return type:

bool

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

Deprecated since version 4.10.