[pygtk] Get a CellRenderer's size

Pietro Battiston toobaz at email.it
Fri Jan 9 19:53:00 WST 2009


Hello,

is there a way to know the (desired) width of a CellRenderer - or
directly of a TreeviewColumn - once it is populated?

I mean; if I know the CellRenderer "cell" is a CellRendererText and it
refers to the first column of my model "model", I can just do:


width = 0

for index in len(model):
    cell.set_property('text', model.get_value(model.get_iter(index), 0)
    width = max (width, cell.get_size()[2])


but in general, my CellRenderer may be of any type and it may have a
strange populating criterion set with set_cell_data_func.

So are the method that a Treeview itself would use to negotiate sizes
exposed to the pygtk bindings?

thanks

Pietro



More information about the pygtk mailing list