Reputation: 176
So I have a black and white GUI and I need to use check boxes, well I set it up and the check box looks ok until I click it and then suddenly the check mark wont stay past my click. The issue comes from the line that starts changing the color of the button. But I need this color scheme, I also need to be able to see the checkmark though.
from Tkinter import *
master = Tk()
checkCmd= IntVar()
checkCmd.set(False)
test = Checkbutton(master, variable=checkCmd, onvalue=True, offvalue=False, text="Old Testament", \
bg='black', fg='white', activebackground='black', activeforeground='white')
test.pack()
buttonCmd = Button(master, text="Run Checked Items").pack()
mainloop()
Upvotes: 4
Views: 2852
Reputation: 22503
The check icon shares the foreground color which is white, and your activeforeground is also white.
A simple way is to change the selectcolor
which adjusts the background of the selector:
test = Checkbutton(master, variable=checkCmd, onvalue=True, offvalue=False, text="Old Testament",
bg='black', fg='white', activebackground='black', activeforeground='white',selectcolor="black")
Upvotes: 10