0

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_FIXED?

gpoo
  • 8,408
  • 3
  • 38
  • 53
Claudiu
  • 224,032
  • 165
  • 485
  • 680

1 Answers1

0

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
Shaung
  • 508
  • 4
  • 11