gtk.CellLayout — an interface for packing cells
class gtk.CellLayout(gobject.GInterface): |
This interface is available in PyGTK 2.4 and above.
gtk.CellLayout
is an interface to be implemented by all objects that want to provide a
gtk.TreeViewColumn
-like
API for packing cells, setting attributes and data funcs. The gtk.CellLayout
interface is implemented by the gtk.ComboBoxEntry
,
gtk.ComboBox
,
gtk.EntryCompletion
and gtk.TreeViewColumn
widgets.
def pack_start(cell
, expand
=True)
| A gtk.CellRenderer . |
| if True , the
cell is to be given extra space that is
allocated to the cell layout. |
This method is available in PyGTK 2.4 and above.
The pack_start
() method packs the gtk.CellRenderer
specified by cell
into the beginning of the cell
layout. If the optional parameter expand
is
False
, then cell
is allocated no
more space than it needs. Any unused space is divided evenly between cells
for which expand
is True
.
def pack_end(cell
, expand
=True)
| A gtk.CellRenderer . |
| if True , the
cell is to be given extra space that is
allocated to the cell layout. |
This method is available in PyGTK 2.4 and above.
The pack_end
() method adds the gtk.CellRenderer
specified by cell
to the end of the cell layout. If
the optional parameter expand
is
False
, then the cell
is allocated
no more space than it needs. Any unused space is divided evenly between
cells for which expand
is
True
.
def clear()
This method is available in PyGTK 2.4 and above.
The clear
() method unsets all the
attribute mappings on all cell renderers in the cell layout.
def get_cells()
Returns : | A list of cell renderers. |
This method is available in PyGTK 2.12 and above.
The get_cells
() method returns the cell
renderers which have been added to cell_layout.
def set_attributes(cell
, ...
)
| A gtk.CellRenderer . |
| Zero or more keyword-value arguments in the format attribute=column. |
This method is available in PyGTK 2.4 and above.
The set_attributes
() method sets the
attributes provided as a keyword argument list as the attributes of the
gtk.CellRenderer
specified by cell
. The attributes should be supplied
as keyword-value arguments in the format: attribute=column (e.g. text=0,
background=1). All existing attributes are removed, and replaced with the
new attributes.
def add_attribute(cell
, attribute
, column
)
| A gtk.CellRenderer . |
| An attribute on the renderer. |
| The column number in the model to get the attribute from. |
This method is available in PyGTK 2.4 and above.
The add_attribute
() method adds an
attribute mapping to the list in the cell layout. The
column
parameter is the column of the model to get a
value from, and the attribute
parameter is the
attribute of cell
to be set from the value. So for
example if column 2 of the model contains strings, you could have the "text"
attribute of a gtk.CellRendererText
get its values from column 2.
def set_cell_data_func(cell
, func
, func_data
)
| A gtk.CellRenderer . |
| The function to use. |
| The user data for func . |
This method is available in PyGTK 2.4 and above.
The set_cell_data_func
() method sets
the function (or method) specified by func
to be used
for setting the column value of the gtk.CellRenderer
specified by cell
instead of using the standard
attribute mapping method. func
may be
None
to remove the current function. The signature of
func
is:
def celldatafunction(
celllayout
,cell
,model
,iter
,user_data
)
def celldatamethod(
self
,celllayout
,cell
,model
,iter
,user_data
)
where celllayout
is the gtk.CellLayout
,
cell
is the gtk.CellRenderer
for celllayout
, model
is the
gtk.TreeModel
and
iter
is the gtk.TreeIter
pointing at the row.
def clear_attributes(cell
)
| A gtk.CellRenderer to clear the attribute mapping on. |
This method is available in PyGTK 2.4 and above.
The clear_attributes
() method clears
all existing attribute mappings from the gtk.CellRenderer
specified by cell
previously set with the set_attributes
()
or add_attribute
()
methods.
def reorder(cell
, position
)
| A gtk.CellRenderer to reorder. |
| New position to insert cell at. |
This method is available in PyGTK 2.4 and above.
The reorder
() method re-inserts the
gtk.CellRenderer
specified by cell
at
position
. Note that cell
has
to already be packed into cell_layout
for this to
function properly.