[Python]使用Python内置包来获取Windows的分辨率

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的分辨率

赞 (4) 打赏

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏