-1
我在Python 3.6.4寫了一個程序使用的Tkinter庫如何在treeview中添加按鈕?
from tkinter import ttk
import tkinter
root = tkinter.Tk()
tree = ttk.Treeview(root)
tree["columns"]=("one","two")
tree.column("one", width=100)
tree.column("two", width=100)
tree.heading("one", text="coulmn A")
tree.heading("two", text="column B")
tree.insert("" , 0, text="Line 1", values=("1A","1b"))
id2 = tree.insert("", 1, "dir2", text="Dir 2")
tree.insert(id2, "end", "dir 2", text="sub dir 2", values=("2A","2B"))
##alternatively:
tree.insert("", 3, "dir3", text="Dir 3")
tree.insert("dir3", 3, text=" sub dir 3",values=("3A"," 3B"))
tree.pack()
root.mainloop()
我想補充的樹狀按鈕,我不知道怎麼樣。
我不知道這是可能的。據此:https://stackoverflow.com/questions/16755176/tkinter-insert-a-combobox-inside-a-treeview-widget treeview小部件不支持嵌入的小部件。 – kogito