Skip to main content

Fixed Tkinter-based GUI window blurry on high-DPI monitors.

Project description

https://github.com/Wulian233/hidpi-tk/actions/workflows/ci.yml/badge.svg https://codecov.io/gh/Wulian233/hidpi-tk/branch/main/graph/badge.svg https://img.shields.io/pypi/v/hidpi-tk.svg

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: <https://github.com/python/cpython/pull/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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hidpi_tk-1.0.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

hidpi_tk-1.0.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file hidpi_tk-1.0.0.tar.gz.

File metadata

  • Download URL: hidpi_tk-1.0.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.0

File hashes

Hashes for hidpi_tk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2f6c1921ec22d1f24d0f720cc5dfdbc764ad68c4e98f44fb9df8fb0e2ba22975
MD5 3a38211e6257c7d25a2ee9a4f493228b
BLAKE2b-256 3799dd35ff07ef6d284d836b6c8e21cb8c35d2ab54a4f744e0668cfb109e2191

See more details on using hashes here.

File details

Details for the file hidpi_tk-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: hidpi_tk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.0

File hashes

Hashes for hidpi_tk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7dc6664003e74084e5432938dac49d1f37bcd70750873735f97920589da3974d
MD5 d3b5cb5ccac5de4c51b5aa3a985adb3a
BLAKE2b-256 84ea0cb8b0c774d03cf94f487ceba7a8d4d0a5944626324d38224022e198cec0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page