Tkinter - Adding multiple columns to a Treeview

前端 未结 2 1693
难免孤独
难免孤独 2021-01-23 12:35

I want to add three columns to my Treeview and name them \'Varenavn\',\'Antall\',\'Best før\'. I tried the following:

self.tree = ttk.Treeview (height = 10, colu         


        
2条回答
  •  孤城傲影
    2021-01-23 13:36

    For example you need to specify

    self.tablex=ttk.Treeview(heigh=10,columns=("#0","#1","#2","#3"))
    

    and later

    self.tablex.heading('#0',text='Text0')
    self.tablex.heading('#1',text='Text1')
    self.tablex.heading('#2',text='Text2')
    self.tablex.heading('#3',text='Text3')
    

提交回复
热议问题