[英]Detect when column in gtk.treeview is resized
What signal can I catch to detect when a column changes size in a gtk.TreeView
? 当列更改
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. gtk.TreeViewColumn不是小部件,所以很遗憾他们没有专门的大小变化信号。 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. 在示例中,
col
必须是gtk.TreeViewColumn
对象。 If you don't initialize the columns in code, you can use gtk.TreeView.get_column
to get these objects. 如果未初始化代码中的列,则可以使用
gtk.TreeView.get_column
来获取这些对象。
If you only need notifications when the treeview changes its size, you can use its "size-allocate" signal instead. 如果您只在树视图更改其大小时需要通知,则可以使用其“大小分配”信号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.