Reputation: 77
I have a list of tuples with str insides (names of actors). I want to display them in a tkinter Treeview.
But the Treeview display only the First Name. e.i Chritoph instead of Christoph Waltz.
Here's a easily executable code of my issue. I just want the entire str to be displayed.
Thank you!
l=[('Amari Cheatom',),('Christoph Waltz',)]
from tkinter import *
from tkinter.ttk import *
root=Tk()
tableauActeur= Treeview(root)
tableauActeur['columns']='Name'
tableauActeur.heading('Name',text="Name")
tableauActeur['show'] = 'headings'
for i in range(len(l)):
tableauActeur.insert('','end',iid=l[i][0],values=l[i][0])
tableauActeur.pack(pady=20)
root.mainloop()
Upvotes: 1
Views: 289
Reputation: 161
Try that:
for i in range(len(l)):
tableauActeur.insert('','end',iid=l[i][0],values=l[i]) # [0] prints only the first word
Upvotes: 2