Skip to content

Scaling

Tom Schimansky edited this page Jan 29, 2023 · 3 revisions

HighDPI support

CustomTkinter supports HighDPI scaling on macOS and Windows by default. On macOS scaling works automatically for Tk windows. On Windows, the app is made DPI aware (windll.shcore.SetProcessDpiAwareness(2)) and the current scaling factor of the display is detected. Then every element and the window dimensions are scaled by this factor by CustomTkinter.

169710599-b7479382-dd9d-4423-9d48-50ec06ca880a

You can deactivate this automatic scaling like the following:

customtkinter.deactivate_automatic_dpi_awareness()

Then the window will be blurry on Windows with a scaling value of more than 100%.

Custom scaling

In addition to the automatically detected scaling factor, you can also set your own scaling factors for the application like the following:

customtkinter.set_widget_scaling(float_value)  # widget dimensions and text size
customtkinter.set_window_scaling(float_value)  # window geometry dimensions

⚠️ Attention ⚠️

The Github Wiki is outdated, the new documentation can be found at:

https://customtkinter.tomschimansky.com

Clone this wiki locally