【发布时间】:2017-10-10 07:33:11
【问题描述】:
我正在尝试通过按“PRTSC”按钮来获取 Windows 中所有显示器的屏幕截图。我的代码需要尽可能精简,这是我想出的最好的解决方案,但是,它在 python 3 中不起作用,这是一个要求。我发送其他击键没有问题。有什么想法吗?
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}")
【问题讨论】:
标签: python python-3.x screenshot win32com sendkeys