Python 3中的跨平台截图

时间:2017-05-09 21:20:30

标签: python-3.x cross-platform screenshot

quite a few questions就像这样,但它们似乎都不是跨平台的,专门用于Python 3,而且我&#39 ;努力寻找可靠的解决方案。

如何在Python 3中使用跨平台截图?

3 个答案:

答案 0 :(得分:0)

您可以使用platform.system()查找当前操作系统,然后根据操作系统使用不同的解决方案:

import platform
if platform.system()=="Windows":
    ...
elif platform.system()=="Darwin": #Mac
    ...
elif plarform.system()=="Linux":
    ...

答案 1 :(得分:0)

My current solution has been to use the $q.all(promises).then(function(promiseResults) { // promiseResult is an array of the return values from the $http request in the order they were pushed into the promises array angular.forEach(promiseResults, function(result, resultIndex) { // Whatever you wanted to do to each result here }); } function from the PIL library, like so:

ImageGrab

答案 2 :(得分:0)

您可以使用 PrtSc 库。

命令:pip3 install PrtSc

代码:

import PrtSc.PrtSc as Screen
screen=Screen.PrtSc(True,"file.png")