开发者

Detect when column in gtk.treeview is resized

开发者 https://www.devze.com 2023-01-21 18:30 出处:网络
What signal can I catch to detect when a column changes size in a gtk.T开发者_如何学运维reeView? I can\'t seem to find it in the docs.gtk.TreeViewColumns aren\'t widgets so they unfortunately don\'t h

What signal can I catch to detect when a column changes size in a gtk.T开发者_如何学运维reeView? I can't seem to find it in the docs.


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.

0

精彩评论

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