Overview
CTkToplevel is a toplevel window class in CustomTkinter. It extends tkinter.Toplevel and provides automatic dark titlebar support on Windows and macOS, along with appearance mode and scaling capabilities. Use this class to create additional windows in your application.
Inheritance
tkinter.Toplevel- Base Tkinter toplevel window classCTkAppearanceModeBaseClass- Provides appearance mode functionalityCTkScalingBaseClass- Provides scaling functionality
Constructor
Positional arguments passed to
tkinter.Toplevel 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.Toplevel constructor. Valid arguments include: master, bd, borderwidth, class, container, cursor, height, highlightbackground, highlightthickness, menu, relief, screen, takefocus, use, visual, width.Methods
configure
Background color of the window.
Additional tkinter.Toplevel configuration options including:
master, bd, borderwidth, class, container, cursor, height, highlightbackground, highlightthickness, menu, relief, screen, takefocus, use, visual, width.cget
Name of the attribute to retrieve. Can be “fg_color” or any valid tkinter.Toplevel 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
destroy
wm_iconbitmap
Path to the icon file (.ico on Windows).
Default icon path.
Usage Example
Advanced Example with Custom Styling
Notes
- The window automatically applies dark titlebar styling on Windows and macOS
- Initial window size is 200x200 pixels (before any scaling)
- Default title is “CTkToplevel”
- On Windows, a default CustomTkinter icon is set automatically after 200ms
- The window is automatically lifted on top when focused on macOS
- Use
grab_set()to make the window modal (blocks interaction with parent window) - Use
attributes("-topmost", True)to keep the window always on top - All size-related methods automatically handle scaling
- The window inherits all standard
tkinter.Toplevelmethods and properties