11.5.
Adding rows to the list
We can add rows in three ways. They can be
prepended or appended to the list using
row = clist.prepend(text)
row = clist.append(text)
|
The return value of these two methods
indicates the number of the row
that was just added. We can insert a row at a given place using
row = clist.insert(row, text)
|
In these calls we have to provide a list
of the strings we want to put in the columns. The number of strings should
equal the number of columns in the list.
Also, please note that the numbering of
both rows and columns start at 0.
To remove an individual row
we use
There is also a call that removes all
rows in the list. This is a lot faster than calling the remove()
method once for each row, which is
the only alternative.
There are also two convenience methods
that should be used when a lot of changes have to be made to the list.
This is to prevent the list flickering while being repeatedly updated,
which may be highly annoying to the user. So instead it is a good idea
to freeze the list, do the updates to it, and finally thaw it which causes
the list to be updated on the screen.
clist.freeze()
clist.thaw()
|