【问题标题】:Simulate the print screen key in python [closed]在python中模拟打印屏幕键[关闭]
【发布时间】:2014-04-16 10:34:31
【问题描述】:

我在谷歌上搜索了很多,但我什么也没得到。 我们可以在 python 中模拟打印屏幕键吗? 如果是,那么如何在python中模拟打印屏幕键?

【问题讨论】:

标签: python python-2.7 simulate printscreen


【解决方案1】:

要截取屏幕截图,您获得的 cmets 将起作用:

Get screenshot on Windows with Python? python auto save printscreen

模拟打印屏幕键,您可以使用击键自动化库,我可以证明其中两个可用于此目的:

1:pywinauto

它使用SendKeyssimulate keystrokes (or see reference here)。

2:Sikuli_cpython

它使用standalone sikuli API 来处理击键等等。然后是 list of keys you can simulate,通过将各自的 unicode char 传递给 sikuli 方法 type()

【讨论】:

    【解决方案2】:

    您可以使用pyautogui 库:

    #pip install pyautogui
    from pyautogui import press
    press("printscreen")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-03
      • 1970-01-01
      • 2022-08-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多