From 9f246f95ec856b9f033e197f251eadeb768eac23 Mon Sep 17 00:00:00 2001 From: Orsiris de Jong Date: Mon, 26 Jan 2026 18:03:44 +0100 Subject: [PATCH] Make dpi_awareness compatible with Windows 11 --- FreeSimpleGUI/__init__.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/FreeSimpleGUI/__init__.py b/FreeSimpleGUI/__init__.py index 5925f37c..385a0b59 100644 --- a/FreeSimpleGUI/__init__.py +++ b/FreeSimpleGUI/__init__.py @@ -8571,10 +8571,15 @@ def set_options( if dpi_awareness is True: if running_windows(): - if platform.release() == '7': - ctypes.windll.user32.SetProcessDPIAware() - elif platform.release() == '8' or platform.release() == '10': - ctypes.windll.shcore.SetProcessDpiAwareness(1) + try: + if platform.release() == '7': + ctypes.windll.user32.SetProcessDPIAware() + # Windows 8, 10 and 11 use the following API + elif int(platform.release()) >= 8: + ctypes.windll.shcore.SetProcessDpiAwareness(1) + except TypeError: + # If platform.release isn't a number, just ignore the API + pass if scaling is not None: DEFAULT_SCALING = scaling