在OSX上使用python拍摄第二个监视器的屏幕截图 [英] Take screenshot of second monitor with python on OSX

查看:76
本文介绍了在OSX上使用python拍摄第二个监视器的屏幕截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Python创建环境照明系统.我已经 pyscreenshot 可以正确保存屏幕截图,但是我不知道如何获取它截图我的第二台显示器(如果可能的话).

I am trying to make an ambient light system with Python. I have gotten pyscreenshot to save a screenshot correctly, but I can't figure out how to get it to screenshot my second monitor (if this is even possible).

是否有一种方法可以使用pyscreenshot(或其他方法)在Python中为我的第二个监视器截屏?如果这有任何区别,我正在使用OSX Yosemite.

Is there a way to take a screenshot of my second monitor in Python using pyscreenshot (or something else)? I am using OSX Yosemite if that makes any difference.

推荐答案

使用内置的screencapture命令并将其传递2个文件名.我相信它位于/usr/sbin/screencapture中,因此命令如下所示:

Use the built-in screencapture command and pass it 2 filenames. I believe it lives in /usr/sbin/screencapture so the command will look like this:

/usr/sbin/screencapture screen1.png screen2.png

我假设您知道如何使用subprocess模块按照这些原则对它进行炮击

I assume you know how to shell out to it using the subprocess module, along these lines

from subprocess import call
call(["/usr/sbin/screencapture", "screen1.png", "screen2.png"])

这篇关于在OSX上使用python拍摄第二个监视器的屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆