开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜