from Tkinter import Tk, Button
import ttk
root = Tk()
tree = ttk.Treeview(root)
tree["columns"]=("one")
tree.column("one" )
# tree.column("two", width=100)
tree.insert("" , 0, values=("1A"))
def edit():
x = tree.get_children()
for item in x: ## Changing all children from root item
tree.item(item, text="blub", values=("foo", "bar"))
def delete():
selected_item = tree.selection()[0] ## get selected item
tree.delete(selected_item)
tree.pack()
button_del = Button(root, text="del", command=delete)
button_del.pack()
button_del = Button(root, text="edit", command=edit)
button_del.pack()
root.mainloop()
I'm trying just to make 1 column using the treeview. But it keeps making one blank one and one that I want it to make. Also when i create 2 columns it makes 3 in total. Not what I want. Tried playing around with the code and no luck. Thanks
Treeviewalways create first column fortree. If you need only one column then you can use this first column without creating other columns - or use standardTkinter.Listbox