Python 检测发送到另一个应用程序的击键
我有一个 Python 程序,它使用 SendKeys 将击键发送到另一个应用程序。然而,某些击键必须在应用程序进行一些处理后发送到应用程序(这需要未知的时间)。到目前为止,我必须通过 Alt+Tab 返回 DOS 窗口并按 Enter 键让 Python 应用程序知道处理已完成。我希望有一个组合键(Shift+F1 或类似的东西),我可以在接收应用程序中按下该组合键,以指示 Python 程序继续,而无需切换回 DOS 窗口。即使焦点位于另一个窗口上,我该如何做才能检测到 Python 中的击键?
I have a Python program that sends keystrokes to another application using SendKeys. Some of the keystrokes, however, must be sent to the application after it does some processing (which takes an unknown amount of time). So far I have had to let the Python application know the processing was finished by Alt+Tabbing back to the DOS window and hitting Enter. I'd like to have a key combination (Shift+F1 or something like that) that I can hit in the receiving application that signals the Python program to continue without me having to switch back to the DOS window. How would I make it so I can detect keystrokes in Python even though the focus is on another window?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看 pyHook。
它允许键盘挂钩:
Have a look at pyHook.
It allows Keyboard hooking: