Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions FreeSimpleGUI/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8571,10 +8571,21 @@ 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:
# Windows Server might return a string like "2022Server" on Python 3.13
# whereas it would return 10 on Python 3.7
# If we happen to find "server" in our release, let's just assume we're running
# a recent windows server version
if "Server" in platform.release():
ctypes.windll.shcore.SetProcessDpiAwareness(1)
elif 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 (ValueError, TypeError):
# If platform.release isn't a number or cant be computed here, just igonore it
pass

if scaling is not None:
DEFAULT_SCALING = scaling
Expand Down