Python获取系统分辨率

it2025-08-30  2

class SystemTools: # 获取当前适用的分辨率 @staticmethod def get_real_resolution(): hDC = win32gui.GetDC(0) w = win32print.GetDeviceCaps(hDC, win32con.DESKTOPHORZRES) h = win32print.GetDeviceCaps(hDC, win32con.DESKTOPVERTRES) print(w, h) return w, h # 按照正常方式获取分辨率 @staticmethod def get_screen_size(): w = win32api.GetSystemMetrics(0) h = win32api.GetSystemMetrics(1) return w, h

 

最新回复(0)