我想稍後迭代Treeview中的數據。然後我希望能夠對它進行分類。Python Tkinter Treeview - 迭代'get_children'輸出
from tkinter import *
from tkinter.ttk import *
import pickle
root = Tk()
def treeData(event):
children = tree.get_children()
print(children)
entry = StringVar()
a = Entry(root, textvariable=entry)
a.grid(column=0,row=0)
a.bind("<Key>", function)
file_data = []
file = open('data.dat', 'rb')
while True:
try:
file_data.append(pickle.load(file))
except EOFError:
break
file.close()
column_names = ("Column 1", "Column 2")
tree = Treeview(root, columns=column_names)
tree['show'] = 'headings'
for x in file_data:
a = tree.insert('', 'end', values=x)
for col in column_names:
tree.heading(col, text=col)
tree.grid(column=0, row=1)
在功能上,被稱爲 'treeData' 當我打印(兒童),其輸出類似於這樣的列表 - ( 'I001', 'I002', 'I003', 'I004')
我希望有人會知道如何將這些數據片段轉換爲Treeview中實際顯示的內容?
感謝,
沒有例子或dummy.dat的虛擬版本不能幫助很多。 – Marcin 2015-02-24 01:09:10