# CustomTkinter — Modern Python Desktop GUI Library > CustomTkinter extends Python's built-in tkinter with a modern look and feel. It provides customizable widgets with light and dark mode support, making it easy to build attractive desktop applications without leaving the Python ecosystem. ## Install Save as a script file and run: # CustomTkinter — Modern Python Desktop GUI Library ## Quick Use ```bash pip install customtkinter ``` ```python import customtkinter as ctk app = ctk.CTk() app.title("My App") ctk.CTkButton(app, text="Click Me").pack(padx=20, pady=20) app.mainloop() ``` ## Introduction CustomTkinter is a Python UI library built on top of the standard tkinter module. It replaces tkinter's dated widget styling with modern, rounded, and themeable components while maintaining full compatibility with existing tkinter code. It is a popular choice for Python developers who want polished desktop UIs without the complexity of Qt or wxWidgets. ## What CustomTkinter Does - Provides modern-looking widgets (buttons, sliders, entries, frames, etc.) that replace stock tkinter widgets - Supports automatic light and dark mode with system-theme detection - Allows custom color themes and scaling for high-DPI displays - Maintains full tkinter API compatibility so existing code can be gradually migrated - Includes complex widgets like tabbed views, scrollable frames, and segmented buttons ## Architecture Overview CustomTkinter draws its widgets on tkinter Canvas objects, replacing the native OS-rendered controls with custom-drawn elements. Each widget is a subclass of its tkinter counterpart, so layout managers (pack, grid, place) work identically. The appearance engine manages color themes through JSON configuration files, and a global scaling system handles DPI-aware sizing across different displays. ## Self-Hosting & Configuration - Install with `pip install customtkinter` on Python 3.7+ - No additional system dependencies beyond tkinter (included in most Python distributions) - Set appearance mode with `ctk.set_appearance_mode("dark")` or `"light"` or `"system"` - Load custom color themes from JSON files using `ctk.set_default_color_theme("path/to/theme.json")` - Adjust widget scaling globally with `ctk.set_widget_scaling(1.5)` for high-DPI screens ## Key Features - Drop-in replacement for tkinter with a modern aesthetic and rounded widget corners - System-aware dark/light mode toggle with no extra code - Custom JSON-based color themes for full branding control - High-DPI scaling support for crisp rendering on Retina and 4K displays - Active community with frequent updates and extensive documentation ## Comparison with Similar Tools - **tkinter (standard)** — built into Python but looks dated; CustomTkinter wraps it with modern styling - **PyQt / PySide** — more powerful with Qt's widget set, but heavier and has licensing considerations - **Kivy** — designed for touch interfaces and mobile; different paradigm from traditional desktop GUIs - **Dear PyGui** — GPU-accelerated immediate-mode GUI; better for data visualization dashboards - **Flet** — Flutter-based Python UI; outputs to web and mobile but requires a different mental model ## FAQ **Q: Does CustomTkinter work on macOS, Windows, and Linux?** A: Yes. It runs on all three platforms wherever tkinter is available. **Q: Can I mix CustomTkinter and standard tkinter widgets?** A: Yes. CustomTkinter widgets are subclasses of tkinter widgets, so they coexist in the same window. **Q: Is it suitable for production applications?** A: For internal tools and medium-complexity desktop apps, absolutely. For very complex UIs with advanced requirements, Qt may be a better fit. **Q: How does dark mode work?** A: Call `set_appearance_mode("dark")` or `"system"` to follow the OS theme. All widgets update their colors automatically. ## Sources - https://github.com/TomSchimansky/CustomTkinter - https://customtkinter.tomschimansky.com/ --- Source: https://tokrepo.com/en/workflows/asset-195556bb Author: Script Depot