如何在Python中获得监视器分辨率? [英] How do I get monitor resolution in Python?

查看:118
本文介绍了如何在Python中获得监视器分辨率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

获得监视器分辨率(最好是在元组中)的最简单方法是什么?

What is the simplest way to get monitor resolution (preferably in a tuple)?

推荐答案

在Windows上:

from win32api import GetSystemMetrics

print("Width =", GetSystemMetrics(0))
print("Height =", GetSystemMetrics(1))

如果要使用高分辨率屏幕,请确保您的python解释器为HIGHDPIAWARE.

If you are working with high resolution screen, make sure your python interpreter is HIGHDPIAWARE.

基于帖子

这篇关于如何在Python中获得监视器分辨率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆