gtk.ListStorea list model to use with a gtk.TreeViewSynopsisgtk.ListStoregobject.GObjectgtk.TreeModelgtk.TreeDragSourcegtk.TreeDragDestgtk.TreeSortablegtk.ListStorecolumn_type...set_column_typestype...set_valueitercolumnvaluesetitercolumn_numvalue...removeiterinsertpositionrowNoneinsert_beforesiblingrowNoneinsert_aftersiblingrowNoneprependrowNoneappendrowNonecleariter_is_validiterreordernew_orderswapabmove_afteriterpositionmove_beforeiterpositionAncestry+-- gobject.GObject
+-- gtk.ListStore
Implemented Interfacesgtk.ListStore
implements
gtk.Buildablegtk.TreeModelgtk.TreeDragSourcegtk.TreeDragDestgtk.TreeSortablegtk.ListStore Signal Prototypesgobject.GObject Signal Prototypesgtk.TreeModel Signal Prototypesgtk.TreeSortable Signal PrototypesDescriptionThe gtk.ListStore
object is a list model for use with a gtk.TreeView
widget. It implements the gtk.TreeModel
interface, the gtk.TreeSortable
and the tree drag and drop interfaces.The gtk.ListStore
objects support the Python mapping and iterator protocols. See the gtk.TreeModel
Description and the PyGTK
tutorial for more information.Constructorgtk.ListStorecolumn_type...column_type :the column type of the first
column... :optional types for succeeding
columnsReturns :a new gtk.ListStoreCreates a new list store as with one or more columns with the type
specified by the arguments passed to the constructor. For example,
gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_STRING,
gtk.gdk.Pixbuf); will create a new gtk.ListStore
with three columns, of type int, string and gtk.gdk.Pixbuf
respectively. The built-in GObject types
are:gobject.TYPE_BOOLEANgobject.TYPE_BOXEDgobject.TYPE_CHARgobject.TYPE_DOUBLEgobject.TYPE_ENUMgobject.TYPE_FLAGSgobject.TYPE_FLOATgobject.TYPE_INTgobject.TYPE_INT64gobject.TYPE_INTERFACEgobject.TYPE_INVALIDgobject.TYPE_LONGgobject.TYPE_NONEgobject.TYPE_OBJECTgobject.TYPE_PARAMgobject.TYPE_POINTERgobject.TYPE_PYOBJECTgobject.TYPE_STRINGgobject.TYPE_UCHARgobject.TYPE_UINTgobject.TYPE_UINT64gobject.TYPE_ULONGThe column types can be any GObject type including
those that are PyGTK objects or application defined objects that are
subclassed from the GObject class.Methodsgtk.ListStore.set_column_typesset_column_typestype...type :the type of the first column... :zero or more type specificationsThis method is available in PyGTK 2.2 and above.The set_column_types() method sets the
liststore columns to the types specified by type and
any additional type parameters. This method is meant primarily for classes
that inherit from gtk.ListStore,
and should only be used when constructing a new gtk.ListStore.
It will not function after a row has been added, or a method on the gtk.TreeModel
interface is called.gtk.ListStore.set_valueset_valueitercolumnvalueiter :a valid gtk.TreeIter for
the row being modifiedcolumn :the column number to
modifyvalue :the new value for the cellThe set_value() method sets the data in
the cell specified by iter and
column. The type of value must
be convertible to the type of the column.gtk.ListStore.setsetitercolumn_numvalue...iter : A valid gtk.TreeIter for
the row being modifiedcolumn_num :the number of the column to
modifyvalue :the new cell value... :additional optional sets of column number -
value pairsThe set() method sets the value of one
or more cells in the row referenced by iter. The
argument list should contain integer column numbers, each followed by the
value to be set (the value must be convertible to the type of the cell
column). For example, to set column 0 with type
gobject.TYPE_STRING to "Foo", you would write:
liststore.set(iter, 0, "Foo")
gtk.ListStore.removeremoveiteriter :A valid gtk.TreeIter for
the rowReturns :True if
iter is still valid.The remove() method removes the row
specified by iter from the list store and returns
True if iter is still valid. After being removed,
iter is set to be the next valid row, or is
invalidated if it pointed to the last row.Prior to PyGTK 2.4 this method returned a new gtk.TreeIter that
is a copy of iter.gtk.ListStore.insertinsertpositionrowNoneposition :the integer position to insert the new
rowrow :an optional list or tuple containing ordered
column values to set on the row or
NoneReturns :A gtk.TreeIter
pointing at the new rowThe insert() method creates a new row
at the location specified by position. If
position is larger than the number of rows on the
list, then the new row will be appended to the list. The row will be empty
if row is not specified or is
None. If row is specified it must
contain a list or tuple of ordered column values (e.g.
[gobject.TYPE_STRING,
gobject.TYPE_INT]) that are used to set the values in the
cells of the new row. Alternatively, the application can fill in row cell
values using the set() or
set_value()
methods.gtk.ListStore.insert_beforeinsert_beforesiblingrowNonesibling :A valid gtk.TreeIter
or Nonerow :an optional list or tuple containing ordered
column values to set on the row or
NoneReturns :A gtk.TreeIter
pointing at the new rowThe insert_before() method inserts a
new row before the row specified by the gtk.TreeItersibling. The row will be empty if
row is not specified or is None.
If row is specified it must contain a list or tuple
of ordered column values (e.g. [gobject.TYPE_STRING,
gobject.TYPE_INT]) that are used to set the values in the
cells of the new row. Alternatively, the application can fill in row cell
values using the set() or
set_value()
methods.In PyGTK 2.4, if sibling is
None the row will be appended to the liststore.gtk.ListStore.insert_afterinsert_aftersiblingrowNonesibling :A valid gtk.TreeIter
or Nonerow :an optional list or tuple containing ordered
column values to set on the row or
NoneReturns :A gtk.TreeIter
pointing at the new rowThe insert_after() method inserts a new
row after the row specified by the gtk.TreeItersibling. The row will be empty if
row is not specified or is None.
If row is specified it must contain a list or tuple
of ordered column values (e.g. [gobject.TYPE_STRING,
gobject.TYPE_INT]) that are used to set the values in the
cells of the new row. Alternatively, the application can fill in row cell
values using the set() or
set_value()
methods.In PyGTK 2.4, if sibling is
None the row will be prepended to the liststore.gtk.ListStore.prependprependrowNonerow :an optional list or tuple containing ordered
column values to set on the row or
NoneReturns :A gtk.TreeIter
pointing at the new rowThe prepend() method prepends a new row
to the liststore. The row will be empty if row is not
specified or is None. If row is
specified it must contain a list or tuple of ordered column values (e.g.
[gobject.TYPE_STRING,
gobject.TYPE_INT]) that are used to set the values in the
cells of the new row. Alternatively, the application can fill in row cell
values using the set() or
set_value()
methods.gtk.ListStore.appendappendrowNonerow :an optional list or tuple containing ordered
column values to set on the row or
NoneReturns :A gtk.TreeIter
pointing at the new rowThe append() method appends a new row
to the liststore. The row will be empty if row is not
specified or is None. If row is
specified it must contain a list or tuple of ordered column values (e.g.
[gobject.TYPE_STRING,
gobject.TYPE_INT]) that are used to set the values in the
cells of the new row. Alternatively, the application can fill in row cell
values using the set() or
set_value()
methods.gtk.ListStore.clearclearThe clear() method removes all rows
from the liststore.gtk.ListStore.iter_is_validiter_is_validiteriter :A gtk.TreeIter.Returns :True if the iter is valid,
False if the iter is invalid.This method is available in PyGTK 2.2 and above.This method is slow. Only use it for debugging and/or testing
purposes.The iter_is_valid() method checks if
the gtk.TreeIter
specified by iter is a valid iter for this gtk.ListStore.gtk.ListStore.reorderreordernew_ordernew_order :a list of integers. The gtk.ListStore
nodes will be rearranged so that the gtk.ListStore
node that is at position index
new_order[i] will be
located at position index
i.This method is available in PyGTK 2.2 and above.The reorder() method reorders the gtk.ListStore
items to follow the order indicated by
new_order. The gtk.ListStore
nodes will be rearranged so that the gtk.ListStore
node that is at position index
new_order[i] will be located
at position index i. Note that this method only
works with unsorted stores.gtk.ListStore.swapswapaba :A
gtk.TreeIter.b :Another gtk.TreeIter.This method is available in PyGTK 2.2 and above.The swap() method swaps the liststore
rows specified by the gtk.TreeIters
a and b. Note that this method
only works with unsorted stores.gtk.ListStore.move_aftermove_afteriterpositioniter :A gtk.TreeIter.position :A gtk.TreeIter
or None.This method is available in PyGTK 2.2 and above.The move_after() method moves the
liststore row referenced by iter to the position
after the row referenced by position. Note that this
method only works with unsorted stores. If position
is None, the row referenced by
iter will be moved to the start of the list.gtk.ListStore.move_beforemove_beforeiterpositioniter :A gtk.TreeIter.position :A gtk.TreeIter,
or None.This method is available in PyGTK 2.2 and above.The move_before() method moves the
liststore row referenced by iter to the position
before the row referenced by position. Note that this
method only works with unsorted stores. If position
is None, the row referenced by
iter will be moved to the end of the list.