简体   繁体   English

如何更改 tkinter Treeview 中某些列/框的颜色?

[英]How can I change the color of certain columns/boxes in a tkinter Treeview?

I'm wondering how I can change the color of a tkinter treeview box.我想知道如何更改 tkinter treeview 框的颜色。 My goal is to try to make it so if the number in the column is above 0, it'd be green, while if it's below 0, it'd be red.我的目标是尝试做到这一点,如果列中的数字大于 0,则为绿色,而如果小于 0,则为红色。 Does anyone know how I can make that happen?有谁知道我怎样才能做到这一点?

See this page for an overview of all widgets and their style options.请参阅此页面以了解所有小部件及其样式选项的概述。 From the bottom of it you can choose one of the following options:从它的底部,您可以选择以下选项之一:

Treeview (widget):
    background
    foreground
    fieldbackground

Heading:
    background
    foreground

Item:
    background
    foreground

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM