简体   繁体   English

Python Tkinter 在 MacOS 中的检查按钮小部件:如何设置文本颜色

[英]Python Tkinter checkbutton widget in MacOS: how do I set the text colour

I'm struggling to find a way to change the foreground colour for the checkbutton widget for Tkinter on Mac.我正在努力寻找一种方法来更改 Mac 上 Tkinter 的检查按钮小部件的前景色。 This is what I've tried.这是我尝试过的。 The foreground colour will always be white no matter what colour i choose.无论我选择什么颜色,前景色都将始终为白色。
cbType = Checkbutton(root, text='Series?', background='#d9d9d9', fg='black', width='9').place(x=120, y=199)
I assume this is an issue with Mac and not Tkinter or Python but if anyone has a fix even if it's importing a plugin like how tkmacosx fixes buttons for mac.我认为这是 Mac 的问题,而不是 Tkinter 或 Python 但如果有人有修复,即使它正在导入一个插件,比如 tkmacosx 如何修复 mac 的按钮。

Try this:尝试这个:

tk.Checkbutton(root, text='Series?', background='black', fg="red", activebackground="black", selectcolor="black")

It should create a checkbutton that has red text and red check mark but everything else is black.它应该创建一个带有红色文本和红色复选标记的复选按钮,但其他所有内容都是黑色的。 Try changing the colours around.尝试改变周围的颜色。

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

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