簡體   English   中英

如何從ttk.Treeview的項目中獲取第0列文本

[英]How to get column 0 text from a ttk.Treeview's item

Treeview.item僅從1開始獲取其他列。 如何獲取c#0列值?

tree.insert("", 0, text="this is what I want to get", values=record)

假設您對該項目具有引用,則可以使用樹的item方法獲取該項目的屬性。 例如,綁定可能看起來像這樣:

def print_text(self, event):
    item = event.widget.identify("item", event.x, event.y)
    text = event.widget.item(item, "text")
    print "the text is '%s'" % text
...
tree.bind("<1>", self.print_text)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM