详谈Python 窗体(tkinter)表格数据(Treeview)
如下所示:
import tkinter from tkinter import ttk #导入内部包 win=tkinter.Tk() tree=ttk.Treeview(win)#表格 tree["columns"]=("姓名","年龄","身高") tree.column("姓名",width=100) #表示列,不显示 tree.column("年龄",width=100) tree.column("身高",width=100) tree.heading("姓名",text="姓名-name") #显示表头 tree.heading("年龄",text="年龄-age") tree.heading("身高",text="身高-tall") tree.insert("",0,text="line1" ,values=("1","2","3")) #插入数据, tree.insert("",1,text="line1" ,values=("1","2","3")) tree.insert("",2,text="line1" ,values=("1","2","3")) tree.insert("",3,text="line1" ,values=("1","2","3")) tree.pack() win.mainloop()
相关推荐
lsjweiyi 2020-11-17
kikaylee 2020-05-31
HMHYY 2020-05-19
AndroidAmelia 2020-05-19
singer 2020-05-07
Jonderwu 2020-05-07
xirongxudlut 2020-05-07
ITxiaobaibai 2020-02-19
柠檬班 2020-02-03
chouliqingke 2019-12-24
liusarazhang 2019-10-29
canvaskin 2019-06-14
lanzh 2019-06-14
xavierri 2019-06-14
vevoly 2019-06-14
BmwGaara 2019-06-14
Wendywubowen 2019-06-14
pythonxuexi 2019-06-14
ciqingloveless 2019-06-13