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

CTkButton _ CustomTkinter

The document provides information on the CTkButton widget from the CustomTkinter library, available since version 0.3.0. It includes example code, arguments for customization, and methods for configuring and invoking the button. Key attributes include size, colors, text, and command functionality.

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)
38 views

CTkButton _ CustomTkinter

The document provides information on the CTkButton widget from the CustomTkinter library, available since version 0.3.0. It includes example code, arguments for customization, and methods for configuring and invoking the button. Key attributes include size, colors, text, and command functionality.

Uploaded by

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

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

CTk Widgets CTkButton

SatGazer Track the


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

Ads by EthicalAds

CTkButton
Available since version 0.3.0.

Example Code

def button_event():
print("button pressed")

button = customtkinter.CTkButton(app, text="CTkButton", command=button_event)

Arguments

argument value

master root, tkinter.Frame or CTkFrame

width button width in px

height button height in px

corner_radius corner radius in px

border_width button border width in px

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

argument value

spacing between text and image and button border in px,


border_spacing
default is 2

forground color, tuple: (light_color, dark_color) or single color


fg_color
or "transparent"

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

border_color border 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

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


font
value for size in pixels)

textvariable tkinter.StringVar object to change text of button

put an image on the button, removes the text, must be class


image
PhotoImage

state "normal" (standard) or "disabled" (not clickable, darker color)

hover enable/disable hover effect: True, False

command callback function

set image orientation if image and text are given ("top", "left",
compound
"bottom", "right")

alignment of text an image in button ("n", "ne", "e", "se", "s",


anchor
"sw", "w", "nw", "center")

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

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

All attributes can be configured, for example:

button.configure(text="new text")

• .cget(attribute_name)

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

text = button.cget("text")

• .invoke()

Calls command if button state is 'disabled'.

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

You might also like