记录学习。
import tkinter
from tkinter import ttk
records=[{'姓名':'张三','年龄':'18','身高':'169'},
{'姓名':'孙明','年龄':'28','身高':'172'},
{'姓名':'李查','年龄':'26','身高':'178'}
]
win=tkinter.Tk()
tree=ttk.Treeview(win,show="headings",columns=("id","name","age","tall"))#表格
##tree["columns"]=("id","name","age","tall")
tree.column("id",width=40) #表示列
tree.column("name",width=100,anchor="center")
tree.column("age",width=100,anchor="center")
tree.column("tall",width=100,anchor="center")
tree.heading("id",text="编号") #显示表头
tree.heading("name",text="姓名")
tree.heading("age",text="年龄")
tree.heading("tall",text="身高")
for i in range(len(records)):
tree.insert("","end",values=(i+1,records[i]['姓名'],records[i]['年龄'],records[i]['身高']))
tree.pack()
win.mainloop()
如图;