I will be honest here and say that I'm playing with the treeviews and ttk without really understand how it works. Nevertheless, I'm getting some issues and after Googling for it I can't find a proper way to fix it. I use treeviews as listbox, since ttk doesn't have a listbox element.
1: Issue 1: somehow I got an extra column all the time, why?
chat = ttk.Treeview(height="26", columns=("Nick","Mensaje","Hora"), selectmode="extended") chat.heading('#0', text='Nick', anchor=W) chat.heading('#1', text='Mensaje', anchor=W) chat.heading('#2', text='Hora', anchor=W) chat.column('#0', stretch=NO, minwidth=0, width=100) chat.column('#1', stretch=NO, minwidth=0, width=510) chat.column('#2', stretch=NO, minwidth=0, width=100) chat.place(bordermode=OUTSIDE, x=5, y=45)
But that adds an extra column at the end so i had to add to fix it:
chat.column('#3', stretch=NO, minwidth=0, width=0)
Issue 2: While I'm trying to insert items to the
treeview, I realized I can't find a way to say where the info should go. For example I want a variable to fillcolumn1but another variable to fillcolumn2. As far as I could go was:chat.insert('', "end", '', text=message)
But that would only add the message on the column0. How do i make it saves it on column1 while another var is saved on column0?
- Issue 3: Is this really the best (easier, actually) way to display a listbox with ttk?
Thank you for your answers.
Edit: i was tring to do something like this: http://pdqi.com/w/Download/BLT/treeview1.gif or http://zoomq.qiniudn.com/ZQScrapBook/ZqFLOSS/data/20100928164510/multicolumn_treeview_plastiktheme.png