From 17127a4117c4e29bff467090ac2cc8da0e757421 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Mon, 2 Oct 2023 20:06:29 +0200 Subject: [PATCH] kvui: silently fail to disable DPI awareness on Windows (#2246) --- kvui.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kvui.py b/kvui.py index 835f0dad..71bf80c8 100644 --- a/kvui.py +++ b/kvui.py @@ -7,7 +7,10 @@ if sys.platform == "win32": import ctypes # kivy 2.2.0 introduced DPI awareness on Windows, but it makes the UI enter an infinitely recursive re-layout # by setting the application to not DPI Aware, Windows handles scaling the entire window on its own, ignoring kivy's - ctypes.windll.shcore.SetProcessDpiAwareness(0) + try: + ctypes.windll.shcore.SetProcessDpiAwareness(0) + except FileNotFoundError: # shcore may not be found on <= Windows 7 + pass # TODO: remove silent except when Python 3.8 is phased out. os.environ["KIVY_NO_CONSOLELOG"] = "1" os.environ["KIVY_NO_FILELOG"] = "1"