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.


A Gtk.TreeIter pointing at the row


The Gtk.TreeModel that the row is part of


The next Gtk.TreeModelRow or None


The parent Gtk.TreeModelRow or htis row or None


The tree path of the row


The previous Gtk.TreeModelRow or None


Returns the next Gtk.TreeModelRow or None


Returns the parent Gtk.TreeModelRow or htis row or None


Returns the previous Gtk.TreeModelRow or None


Returns a Gtk.TreeModelRowIter for the row’s children