gpt4 book ai didi

python /PyQt4 : How do you find the SIZE of a monitor (in inches)?

转载 作者:行者123 更新时间:2023-11-28 17:45:20 26 4
gpt4 key购买 nike

我试图找到以英寸或厘米(不是像素!)为单位的显示器的水平宽度,以制作一个小的“标尺”程序。 DPI 也可以。

我正在使用 PyQt4。

最佳答案

尝试使用 QDesktopWidget 的 width() 和 height() 分别获取宽度和高度。类(class)引用 QDesktopWidget Class Reference , 这将为您提供以像素为单位的屏幕大小,然后使用 QX11Info.appDpiX ,这将为您提供以每英寸像素为单位的 DPI。使用以上信息计算屏幕尺寸(以英寸为单位)。

PS:width() 返回并集宽度,因此如果您有多个屏幕,它将返回所有屏幕的并集宽度。

关于 python /PyQt4 : How do you find the SIZE of a monitor (in inches)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19070370/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com