0% found this document useful (0 votes)
21 views

CTkCheckBox _ CustomTkinter

The document provides an overview of the CTkCheckBox widget in CustomTkinter, including example code and a list of configurable arguments. It details the various attributes such as size, color, and state, as well as methods for interacting with the checkbox. The document serves as a guide for implementing and customizing checkboxes in a CustomTkinter application.

Uploaded by

talhasku14
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

CTkCheckBox _ CustomTkinter

The document provides an overview of the CTkCheckBox widget in CustomTkinter, including example code and a list of configurable arguments. It details the various attributes such as size, color, and state, as well as methods for interacting with the checkbox. The document serves as a guide for implementing and customizing checkboxes in a CustomTkinter application.

Uploaded by

talhasku14
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CTkCheckBox | CustomTkinter https://customtkinter.tomschimansky.com/documentation...

CTk Widgets CTkCheckBox

SatGazer Track the


satellites that orbit the
earth Download now in
the Appstore
dl6fm.com

Ads by EthicalAds

CTkCheckBox
Example Code

def checkbox_event():
print("checkbox toggled, current value:", check_var.get())

check_var = customtkinter.StringVar(value="on")
checkbox = customtkinter.CTkCheckBox(app, text="CTkCheckBox", command=checkbox_event,
variable=check_var, onvalue="on",
offvalue="off")

Arguments

argument value

master root, tkinter.Frame or CTkFrame

width width of complete widget in px

height height of complete widget in px

checkbox_width width of checkbox in px

1 of 3 10/04/2025, 07:36
CTkCheckBox | CustomTkinter https://customtkinter.tomschimansky.com/documentation...

argument value

checkbox_height height of checkbox in px

corner_radius corner radius in px

border_width box border width in px

foreground (inside) color, tuple: (light_color, dark_color) or


fg_color
single color

border_color border color, tuple: (light_color, dark_color) or single color

hover_color hover color, tuple: (light_color, dark_color) or single color

text_color text color, tuple: (light_color, dark_color) or single color

text color when disabled, tuple: (light_color, dark_color) or


text_color_disabled
single color

text string

textvariable Tkinter StringVar to control the text

font button text font, tuple: (font_name, size)

hover enable/disable hover effect: True, False

tkinter.NORMAL (standard) or tkinter.DISABLED (not clickable,


state
darker color)

command function will be called when the checkbox is clicked

variable Tkinter variable to control or read checkbox state

onvalue string or int for variable in checked state

offvalue string or int for variable in unchecked state

2 of 3 10/04/2025, 07:36
CTkCheckBox | CustomTkinter https://customtkinter.tomschimansky.com/documentation...

Methods
• .configure(attribute=value, ...)

All attributes can be configured, for example

checkbox.configure(state="disabled")

• .cget(attribute_name)

Pass attribute name as string and get current value of attribute, for example.

text = checkbox.cget("text")

• .get()

Get current value, 1 or 0 (checked or not checked).

• .select()

Turn on checkbox (set value to 1), command will not be triggered.

• .deselect()

Turn off checkbox (set value to 0), command will not be triggered.

• .toggle()

Flip current value, command will be triggered.

3 of 3 10/04/2025, 07:36

You might also like