TomSchimansky / CustomTkinter

A modern and customizable python UI-library based on Tkinter
MIT License
10.84k stars 1.02k forks source link

How to set the background color of customtkinter.CTkCheckBox #2280

Closed orztrickster closed 4 months ago

orztrickster commented 4 months ago

How to set the background color of customtkinter.CTkCheckBox? You can see that there is a darker area behind "test". 1708709594521 checkbox = customtkinter.CTkCheckBox(frame[3], text="test", command=checkbox_event_1, variable=check_var_1, onvalue="on", offvalue="off")

Anonymous6598 commented 4 months ago

Just use

fg_color = "green" #enter color
orztrickster commented 4 months ago

That's the same, just changes the color of the selection. 1708869495241 1708869510341 checkbox = customtkinter.CTkCheckBox(frame[3], text="test", command=checkbox_event_1, variable=check_var_1, onvalue="on", offvalue="off",fg_color = "green") checkbox.grid(row=0, column=0, padx=(550,5), pady=(0,30))

Anonymous6598 commented 4 months ago

try this:

bg_color = "green" #enter color
Anonymous6598 commented 4 months ago
checkbox = customtkinter.CTkCheckBox(frame[3], text="test", command=checkbox_event_1, variable=check_var_1, onvalue="on", offvalue="off", bg_color = "green")
orztrickster commented 4 months ago

Thank you, this works. Setting bg_color = "#2b2b2b" will make it the same as the background. 1708870312719 checkbox = customtkinter.CTkCheckBox(frame[3], text="test", command=checkbox_event_1, variable=check_var_1, onvalue="on", offvalue="off", bg_color = "green") 1708870364402 checkbox = customtkinter.CTkCheckBox(frame[3], text="test", command=checkbox_event_1, variable=check_var_1, onvalue="on", offvalue="off", bg_color = "#2b2b2b")