gtk.TreeModelRow

gtk.TreeModelRow — an object representing a row in a gtk.TreeModel

Synopsis

class gtk.TreeModelRow:
    def iterchildren()

Ancestry

+-- gobject.GBoxed
    +-- gtk.TreeModelRow

Attributes

"next"ReadThe next gtk.TreeModelRow or None
"parent"ReadThe parent gtk.TreeModelRow of this row or None
"model"ReadThe gtk.TreeModel that the row is part of.
"path"ReadThe tree path of the row
"iter"ReadA gtk.TreeIter pointing at the row.

Description

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.

Methods

gtk.TreeModelRow.iterchildren

    def iterchildren()
Returns :a gtk.TreeModelRowIter for the row's children or None

The iterchildren() method returns a gtk.TreeModelRowIter for iterating over the children of the row or None if the row has no children.