Overview
CTk is the main application window class in CustomTkinter. It extends tkinter.Tk and provides automatic dark titlebar support on Windows and macOS, along with appearance mode and scaling capabilities.
Inheritance
tkinter.Tk- Base Tkinter window classCTkAppearanceModeBaseClass- Provides appearance mode functionalityCTkScalingBaseClass- Provides scaling functionality
Constructor
Background color of the window. Can be a single color string or a tuple of (light_mode_color, dark_mode_color). If None, uses the theme default.
Additional arguments passed to
tkinter.Tk constructor. Valid arguments include: screenName, baseName, className, useTk, sync, use.Methods
configure
Background color of the window.
Additional tkinter.Tk configuration options including:
bd, borderwidth, class, menu, relief, screen, use, container, cursor, height, highlightthickness, padx, pady, takefocus, visual, width.cget
Name of the attribute to retrieve. Can be “fg_color” or any valid tkinter.Tk attribute.
geometry
Geometry string in format “widthxheight+x+y” or “widthxheight”. If None, returns current geometry.
geometry_string is None.
minsize
Minimum width in pixels.
Minimum height in pixels.
maxsize
Maximum width in pixels.
Maximum height in pixels.
resizable
Whether the window can be resized horizontally.
Whether the window can be resized vertically.
withdraw
iconify
deiconify
mainloop
Arguments passed to tkinter.Tk.mainloop().
Keyword arguments passed to tkinter.Tk.mainloop().
update
destroy
iconbitmap
Path to the icon file (.ico on Windows).
Default icon path.
wm_iconbitmap
iconbitmap() method.
Path to the icon file (.ico on Windows).
Default icon path.
Usage Example
Advanced Example
Notes
- The window automatically applies dark titlebar styling on Windows and macOS
- Initial window size is 600x500 pixels (before any scaling)
- Default title is “CTk”
- On Windows, a default CustomTkinter icon is set automatically
- All size-related methods (
geometry,minsize,maxsize) automatically handle scaling - The window inherits all standard
tkinter.Tkmethods and properties