Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在OSX上使用python拍摄第二个监视器的屏幕截图_Python_Macos_Screenshot - Fatal编程技术网

在OSX上使用python拍摄第二个监视器的屏幕截图

在OSX上使用python拍摄第二个监视器的屏幕截图,python,macos,screenshot,Python,Macos,Screenshot,我正在尝试用Python制作一个环境光系统。我已经正确地保存了一个屏幕截图,但我不知道如何将它保存到我的第二个显示器的屏幕截图上(如果这是可能的话) 有没有一种方法可以使用pyscreenshot(或其他东西)在Python中拍摄我的第二个监视器的屏幕截图?如果有什么不同的话,我使用的是OSX Yosemite。使用内置的屏幕截图命令,并将2个文件名传递给它。我相信它存在于/usr/sbin/screenscapture中,因此命令如下所示: /usr/sbin/screencapture sc

我正在尝试用Python制作一个环境光系统。我已经正确地保存了一个屏幕截图,但我不知道如何将它保存到我的第二个显示器的屏幕截图上(如果这是可能的话)


有没有一种方法可以使用pyscreenshot(或其他东西)在Python中拍摄我的第二个监视器的屏幕截图?如果有什么不同的话,我使用的是OSX Yosemite。

使用内置的
屏幕截图
命令,并将2个文件名传递给它。我相信它存在于
/usr/sbin/screenscapture
中,因此命令如下所示:

/usr/sbin/screencapture screen1.png screen2.png
我假设您知道如何使用
子流程
模块,按照以下思路来完成它

from subprocess import call
call(["/usr/sbin/screencapture", "screen1.png", "screen2.png"])
这是正确的。这也不能直接用
pyscreenshot
来完成。如果你看一下,你会注意到在MacOSX上,他们确实使用了
screenscapture
实用程序,但只将一个文件作为参数传递给它。文档(
man screenscapture
)中说,您必须传入与屏幕数量相同的文件:

文件–屏幕截图的保存位置,每个屏幕1个文件