简体   繁体   中英

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. 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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