#663·pyautogui

使用 pyautogui 导入时,会破坏 ctypes 中的显示器 DPI 检测

作者: GeorgeWashingtonABCDEFG创建于 2022年1月31日更新于 2026年4月23日

import ctypes

import pyautogui

dpix = ctypes.c_uint() dpiy = ctypes.c_uint() ctypes.windll.shcore.SetProcessDpiAwareness(2) ctypes.windll.shcore.GetDpiForMonitor(1186359, 0, ctypes.byref(dpix), ctypes.byref(dpiy)) print(dpix.value)

内容来源: asweigart/pyautogui