RT 这个需求是我在用Python 写GUI的时候想到的,有好多种解决方案,包括了使用win32api(可用pip install pypiwin32 安装,不过这个出问题,感觉没法用),以及wxPython(另一个Python的Windows GUI包),但是这些都不及Python内置的包好,代码如下:
import ctypes
user32 = ctypes.windll.user32
screensize = user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)
print(screensize)
未经允许不得转载:RffanLAB|Rffan实验室 » [Python]使用Python内置包来获取Windows的分辨率