简体   繁体   English

pyautogui 模块中的 size() 函数

[英]size() function in pyautogui module

I need to get the size of the screen for a project I am working on.我需要获取我正在处理的项目的屏幕大小。 A complication here is when a monitor is connected to the CPU, that function returns the size of the monitor.这里的一个复杂问题是当监视器连接到 CPU 时,该函数返回监视器的大小。 But if I connect to a projector instead, say, SVGA quality of dimension 320*240 resolution, will that function return me the corresponding tuple, or would it throw me an error?但是,如果我改为连接到投影仪,例如尺寸为 320*240 分辨率的 SVGA 质量,该函数会返回相应的元组,还是会抛出错误?

And what is the outcome when we don't have a monitor connected at all?如果我们根本没有连接显示器,结果会怎样? Can somebody try and post back?有人可以尝试回帖吗? PS: I don't have a desktop. PS:我没有台式机。 We will be installing it on RPI eventually.我们最终会在 RPI 上安装它。

I'm not sure about your question but i will try to help you... to get the screen size using pyautogui, use this function: pyautogui.size()我不确定您的问题,但我会尽力帮助您...使用 pyautogui 获取屏幕大小,请使用此函数: pyautogui.size()

Pyautogui use pixels as reference. Pyautogui 使用像素作为参考。 You can try to set your screen definition or use coordenates to find images: pyautogui.click(x=100, y= 200) or pyautogui.doubleClick(x=100, y=200) .您可以尝试设置屏幕定义或使用坐标查找图像: pyautogui.click(x=100, y= 200)pyautogui.doubleClick(x=100, y=200)

X and Y are coordenates! X 和 Y 是坐标!

More info here 更多信息在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM