Detect when column in gtk.treeview is resized

自作多情 提交于 2019-12-10 18:56:45

问题


What signal can I catch to detect when a column changes size in a gtk.TreeView? I can't seem to find it in the docs.


回答1:


gtk.TreeViewColumns aren't widgets so they unfortunately don't have a dedicated signal for size changes. But you can register a callback function that receives "width" change notifications:

def onColWidthChange(col, width):
    # Note that "width" is a GParamInt object, not an integer
    ...

col.connect("notify::width", onColWidthChange)

In the example, col must be a gtk.TreeViewColumn object. If you don't initialize the columns in code, you can use gtk.TreeView.get_column to get these objects.

If you only need notifications when the treeview changes its size, you can use its "size-allocate" signal instead.



来源:https://stackoverflow.com/questions/3999146/detect-when-column-in-gtk-treeview-is-resized

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!