Is there a way to get the width, in pixels, that a gtk.TreeViewColumn
would want to be if the sizing mode was set as gtk.TREE_VIEW_COLUMN_AUTOSIZE
, even if it's currently gtk.TREE_VIEW_COLUMN开发者_StackOverflow社区_FIXED
?
I think gtk.TreeViewColumn.cell_get_size() will do the job.
Sample code:
def show_size(treeview):
col = treeview.get_column(0)
cell = col.get_cell_renderers()[0]
size = col.cell_get_position(cell)
print 'current size: position=%s, width=%s' % size
size = col.cell_get_size()
print 'autosize: %s, x=%s, y=%s, w=%s, h=%s' % size
精彩评论