Skip to content

A Python library designed to enhance Tkinter-based GUI by automatically adjusting DPI scaling and font sizes, particularly for high-DPI monitors

License

Notifications You must be signed in to change notification settings

Wulian233/hidpi-tk

Repository files navigation

hidpi-tk

hidpi-tk is a Python library designed to enhance Tkinter-based GUI applications by automatically adjusting DPI scaling and font sizes, particularly for high-DPI monitors.

https://raw.githubusercontent.com/Wulian233/hidpi-tk/refs/heads/main/screenshot.png

Features

  • Automatic DPI Scaling
  • Automatic Font Size Adjustment
  • Without side-effects
  • Cross-Platform

Usage

To use this library, simply replace the standard Tk class with DPIAwareTk. The library will handle DPI and font adjustments automatically:

from hidpi_tk import DPIAwareTk
# from tkinter import Tk

# root = Tk()
root = DPIAwareTk()
# After that use like Tk instance
root.mainloop()

Details

On Windows systems, it provides full support for scaling on high-DPI monitors, particularly for Windows 8.1 and newer. For older Windows systems (Vista & Win7) , it still adjusts DPI and font scaling to an extent.

For other systems, such as macOS and Linux, the operating systems themselves provide excellent high-DPI support, so this library does not include specific code for DPI adjustments. However, using this library is still beneficial as it adjusts font scaling, which makes cross-platform development easier and more consistent.

Font scaling is called from idlelib, so the minimum required version is Python 3.6. See: <python/cpython#3639>

License

hidpi-tk library is offered under Apache 2 license.

Thanks

The library development is based on high-dpi-tkinter.

Added: High-DPI font scaling support, legacy Windows support, bug fixes, and modern Python standards.

About

A Python library designed to enhance Tkinter-based GUI by automatically adjusting DPI scaling and font sizes, particularly for high-DPI monitors

Resources

License

Stars

Watchers

Forks

Languages