开发者

Get the width of a TreeViewColumn that would like to be if it were autosized

开发者 https://www.devze.com 2023-01-21 04:40 出处:网络
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开发者_S

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
0

精彩评论

暂无评论...
验证码 换一张
取 消