| PyGTK Tutorial | ||
|---|---|---|
| <<< Previous | Chapter 11. CList Widget | Next >>> |
clist.set_column_justification(column, justification) |
The justification can take the following values:
JUSTIFY_RIGHT - The text in the column will begin from the right edge.
JUSTIFY_CENTER - The text is placed in the center of the column.
JUSTIFY_FILL - The text will use up all available space in the column. It is normally done by inserting extra blank spaces between words (or between individual letters if it's a single word). Much in the same way as any ordinary WYSIWYG text editor.
clist.set_column_width(column, width) |
Note that the width
is given in pixels and not letters. The same goes for the height
of the cells in the columns, but as the default value is the height of
the current font this isn't as critical to the application. Still, it is
done through
clist.set_row_height(height) |
Again, note that the height is given in pixels.
We can also move the list around without
user interaction, however, it does require that we know what we are looking
for. Or in other words, we need the row
and column of the item we
want to scroll to.
clist.moveto(row, column, row_align, col_align) |
The row_align is pretty important to understand. It's a value between 0.0 and 1.0, where 0.0 means that we should scroll the list so the row appears at the top, while if the value of row_align is 1.0, the row will appear at the bottom instead. All other values between 0.0 and 1.0 are also valid and will place the row between the top and the bottom. The last argument, col_align works in the same way, though 0.0 marks left and 1.0 marks right instead.
Depending on the application's needs,
we don't have to scroll to an item that is already visible to us. So how
do we know if it is visible? As usual, there is a method to find that out
as well.
visibility = clist.row_is_visible(row) |
The return value is is one of the following:
VISIBILITY_NONE VISIBILITY_PARTIAL VISIBILITY_FULL |
Note that it will only tell us if a row is visible. Currently there is no way to determine this for a column. We can get partial information though, because if the return is VISIBILITY_PARTIAL, then some of it is hidden, but we don't know if it is the row that is being cut by the lower edge of the listbox, or if the row has columns that are outside.
We can also change both the foreground
and background colors of a particular row. This is useful for marking the
row selected by the user, and the two methods that are used to do it are
clist.set_foreground(row, color) clist.set_background(row, color) |
Please note that the colors must have been previously allocated.
| <<< Previous | Home | Next >>> |
| Working with titles | Up | Adding rows to the list |