如何在ttk.Treeview子节点中

时间:2018-11-27 12:50:36

标签: python

我想在图表的箭头“ 9”处将其设置为红色。而不是整行,我该怎么办? enter image description here

import tkinter as tk
from tkinter import ttk

root = tk.Tk()
tree = ttk.Treeview(root, show='headings')
buf = ['one', 'two', 'three', 'four', 'five']
tree["columns"] = buf
for i in buf:
    tree.column(i, width=len(i)*10)
    tree.heading(i, text=i)
for i in range(1, 5):
    tree.insert('', i-1, values=[i*y for y in range(1, 6)])

tree.item(tree.get_children()[2], tags=['tag_1'])
tree.tag_configure('tag_1', foreground='red')

tree.pack()
root.mainloop()

0 个答案:

没有答案