简体   繁体   中英

Detect when column in gtk.treeview is resized

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.

gtk.TreeViewColumn s 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM