Python 拍摄屏幕截图时,autopy会显示一个值错误

Python 拍摄屏幕截图时,autopy会显示一个值错误,python,python-3.x,autopy,Python,Python 3.x,Autopy,我正试图用autopy在我的屏幕上拍摄一个小部分的图像,由于某种原因,我得到了一个错误。作为参考,我在1920x1080显示器上运行。代码如下: box = ((995, 5), (995 + 212, 5 + 72)) autopy.bitmap.capture_screen(box) Traceback (most recent call last): File "<input>", line 1, in <module> ValueError: The Imag

我正试图用autopy在我的屏幕上拍摄一个小部分的图像,由于某种原因,我得到了一个错误。作为参考,我在1920x1080显示器上运行。代码如下:

box = ((995, 5), (995 + 212, 5 + 72))
autopy.bitmap.capture_screen(box)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
ValueError: The Image's dimensions are either too small or too large
box=((995,5)、(995+212,5+72))
自动剖检.位图.捕获屏幕(框)
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
ValueError:图像的尺寸太小或太大
谁能告诉我我做错了什么吗?

函数

autopy.bitmap.capture\u屏幕

取第一个元组中的左上角点,然后在下一个元组中取宽度和高度。因此,要解决您的问题,只需使用

box = ((995, 5), (212, 72))
autopy.bitmap.capture_screen(box)

非常感谢,我还以为第二个元组是右下角的呢,没问题:)。我也这么认为,文档也没有什么帮助。我自己测试了一段时间才发现。