11.6.
Setting text and pixmaps in the cells
A cell can contain a pixmap, text or both.
To set them the following methods are used.
clist.set_text(row, column, text)
clist.set_pixmap(row, column, pixmap, mask)
clist.set_pixtext(row, column, text, spacing, pixmap, mask)
|
It's quite straightforward. All the calls
have the row and column
of the cell as the first two arguments, followed by the data to be set.
The spacing argument in the
set_pixtext() method is the
number of pixels between the pixmap
and the beginning of the text.
In all cases the data is copied into the widget.
To read back the data, we use:
text = clist.get_text(row, column)
pixmap, mask = clist.get_pixmap(row, column)
text, spacing, pixmap, mask = clist.get_pixtext(row, column)
|
There is one more call that is related
to what's inside a cell in the clist,
and that's
cell_type = clist.get_cell_type(row, column)
|
which returns the type of data in a cell.
The return value is one of
CELL_EMPTY
CELL_TEXT
CELL_PIXMAP
CELL_PIXTEXT
CELL_WIDGET
|
There is also a method that will let us
set the indentation, both vertical and horizontal, of a cell. The indentation
value is an integer, given in pixels, and can be both positive and negative.
clist.set_shift(row, column, vertical, horizontal)
|