我正在使用python 2.7和Tkinter设计一个基本工具来填充表格中的信息。我希望能够通过单击它来编辑显示名称类别,并在删除列中有一个按钮将其从树视图中删除..我的代码在下面,并且是我通常尝试制作的模型图像可在此处找到Link for mockup。这是我到目前为止的代码:
from Tkinter import *
import ttk
root = Tk()
root.wm_title("Manage")
frame = ttk.Frame(root)
frame.pack()
tree=ttk.Treeview(frame)
style = ttk.Style()
style.configure(".", font = ("Helvetica", 14))
style.configure("Treeview.Heading", font = ("Helvetica", 16) )
tree["columns"] = ("one", "two", "three", "four")
tree.column("one", width=170)
tree.column("two", width=255)
tree.column("three", width=510)
tree.column("four", width=85)
tree.heading('#0', text = "Type")
tree.heading("one", text = "Category")
tree.heading("two", text = "Display Name")
tree.heading("three", text = "GUID")
tree.heading("four", text = "Delete")
tree.insert("" , 0, text = "Line 1", values = ("1A","1b"), tag = "orow")
id2 = tree.insert("", 1, "dir2", text = "Dir 2", tag = "erow")
tree.insert(id2, "end", "dir 2", text = "sub dir 2", values = ("2A","2B"))
tree.tag_configure('orow', background = '#EEEEEE')
tree.tag_configure('erow', background = '#CACBCB')
tree.pack()
root.mainloop()
我是Tkinter的新手,TkDocs有点令人困惑。感谢