1 回答

TA贡献1813条经验 获得超2个赞
问题:将带有字典的嵌套列表中的数据添加到树视图
# Set 'text' to the first column heading
tree.heading('#0', text='Name')
# Insert Tree Heading as Item 'dirIso'
# Set 'text' to "Isolering"
tree.insert("", 1, "dirIso", text="Isolering")
# Loop first list
for n, dirIso in enumerate(isolering,1):
# Make a list of values from the list of Dictionaries
list_of_column_values =
[list(_dict.values())[0] for _dict in dirIso]
# Insert the list of values
# First value goes to Treeview 'text'
# All other values into the following Columns
tree.insert('dirIso', n, text=list_of_column_values[0],
values=list_of_column_values[1:])
用 Python 测试:3.5
添加回答
举报