Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/291.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/8/python-3.x/18.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
Python 3 Win32 SendKeys{PrtSc}不工作_Python_Python 3.x_Screenshot_Win32com_Sendkeys - Fatal编程技术网

Python 3 Win32 SendKeys{PrtSc}不工作

Python 3 Win32 SendKeys{PrtSc}不工作,python,python-3.x,screenshot,win32com,sendkeys,Python,Python 3.x,Screenshot,Win32com,Sendkeys,我试图通过按下“PRTSC”按钮来抓取Windows中所有监视器的屏幕截图。我的代码需要尽可能精简,这是我提出的最好的解决方案,但是,它在Python3中不起作用,这是一个要求。我没有问题发送其他按键。有什么想法吗 import win32com.client class SendKeys: def __init__ (self): self.win = win32com.client.Dispatch("WScript.Shell") def send (se

我试图通过按下“PRTSC”按钮来抓取Windows中所有监视器的屏幕截图。我的代码需要尽可能精简,这是我提出的最好的解决方案,但是,它在Python3中不起作用,这是一个要求。我没有问题发送其他按键。有什么想法吗

import win32com.client

class SendKeys:
    def __init__ (self):
        self.win = win32com.client.Dispatch("WScript.Shell")
    def send (self, data):
        self.win.SendKeys(data, 0)

sk = SendKeys()
sk.send("{PrtSc}")
支票:或。 这些链接有助于使用“PrtSc”按钮截图