Gtk.TreeModelRow

Class Details

class Gtk.TreeModelRow(model, iter_or_path)

A Gtk.TreeModelRow object represents a row in a Gtk.TreeModel. A Gtk.TreeModelRow is created by taking the mapping of a Gtk.TreeModel. For example:

treemodelrow = liststore[0]
treemodelrow = liststore[(0,)]
treemodelrow = liststore['0']

all create a Gtk.TreeModelRow for the first row in liststore. The Gtk.TreeModelRow implements some of the Python sequence protocol that makes the row behave like a sequence of objects. Specifically a tree model row has the capability of:

  • getting and setting column values,

  • returning a tuple or list containing the column values, and

  • getting the number of values in the row i.e. the number of columns

For example to get and set the value in the second column of a row, you could do the following:

value = treemodelrow[1]
treemodelrow[1] = value

You can use the Python len() function to get the number of columns in the row and you can retrieve all the column values as a list (tuple) using the Python list() (tuple()) function.

The Gtk.TreeModelRow supports one method: the iterchildren() method that returns a Gtk.TreeModelRowIter for iterating over the children of the row.

iter

A Gtk.TreeIter pointing at the row

model

The Gtk.TreeModel that the row is part of

next

The next Gtk.TreeModelRow or None

parent

The parent Gtk.TreeModelRow or htis row or None

path

The tree path of the row

previous

The previous Gtk.TreeModelRow or None

get_next()

Returns the next Gtk.TreeModelRow or None

get_parent()

Returns the parent Gtk.TreeModelRow or htis row or None

get_previous()

Returns the previous Gtk.TreeModelRow or None

iterchildren()

Returns a Gtk.TreeModelRowIter for the row’s children