pyqt5 获取显示器的分辨率的方法
作者:pursuit_zhangyu 时间:2023-10-25 09:51:36
代码如下
import sys
from PyQt5.QtWidgets import QApplication, QWidget
class Example(QWidget):
def __init__(self):
super().__init__()
self.initUI() # 界面绘制交给InitUi方法
def initUI(self):
self.desktop = QApplication.desktop()
#获取显示器分辨率大小
self.screenRect = self.desktop.screenGeometry()
self.height = self.screenRect.height()
self.width = self.screenRect.width()
print(self.height)
print(self.width)
# 显示窗口
self.show()
if __name__ == '__main__':
# 创建应用程序和对象
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
来源:https://blog.csdn.net/pursuit_zhangyu/article/details/83508025
标签:pyqt5,显示器,分辨率
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
统计热门文章的算法
2008-03-16 15:40:00
Python环境下安装PyGame和PyOpenGL的方法
2021-12-09 10:14:38
![](https://img.aspxhome.com/file/2023/3/81693_0s.png)
python实现单张图像拼接与批量图片拼接
2023-07-28 12:33:36
![](https://img.aspxhome.com/file/2023/0/59300_0s.jpg)
如何捕获人家站点的页面?
2009-11-11 19:19:00
JavaScript中利用for循环遍历数组
2024-03-17 02:21:54
![](https://img.aspxhome.com/file/2023/3/56403_0s.jpg)
使用Python来编写HTTP服务器的超级指南
2022-12-28 20:40:24
![](https://img.aspxhome.com/file/2023/2/90652_0s.png)
解决python3 urllib 链接中有中文的问题
2022-10-19 08:43:51
MySQL自定义序列数的实现方式
2024-01-14 00:09:50
sql语句中单引号嵌套问题(一定要避免直接嵌套)
2024-01-16 14:48:52
Vue 项目性能优化方案分享
2024-05-10 14:20:36
MySQL索引背后的之使用策略及优化(高性能索引策略)
2024-01-23 04:21:19
![](https://img.aspxhome.com/file/2023/9/110299_0s.png)
详解Python3中yield生成器的用法
2021-09-03 05:59:27
MySQL开发规范与使用技巧总结
2024-01-19 00:44:00
mysql中判断记录是否存在方法比较
2024-01-27 05:14:49
简析Python的闭包和装饰器
2021-06-25 03:25:40
![](https://img.aspxhome.com/file/2023/4/82654_0s.png)
为什么MySQL选择Repeatable Read作为默认隔离级别
2024-01-13 01:09:26
![](https://img.aspxhome.com/file/2023/6/122936_0s.jpg)
Python基于list的append和pop方法实现堆栈与队列功能示例
2022-10-20 02:26:26
![](https://img.aspxhome.com/file/2023/4/69014_0s.jpg)
对Python强大的可变参数传递机制详解
2021-06-23 02:54:09
兼容所有浏览器的设为首页与显示小策略
2009-01-12 18:50:00
![](https://img.aspxhome.com/file/UploadPic/20091/12/make-y-home-page-firefox-57s.png)
Python文件操作,open读写文件,追加文本内容实例
2022-09-03 12:43:17