python - 以编程方式发送键盘中断

标签 python windows

请求键盘中断的应用程序。如何以编程方式发送键盘中断?我需要它来实现自动化。 喜欢<C-c><C-x>

KeyboardInterrupt 

最佳答案

在单独线程中运行的代码可以通过调用 thread.interrupt_main() 在主线程中生成 KeyboardInterrupt。 参见 https://docs.python.org/2/library/thread.html#thread.interrupt_main

关于python - 以编程方式发送键盘中断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7602120/

相关文章:

python - 第二个最新文件

python - 如何在 matplotlib 中旋转 ticklabel_format?

python - 数组的连续、重叠子集(NumPy、Python)

python - 如何解决类型错误: create_superuser() got an unexpected keyword argument 'paid' in django

c# - 如何绘制一个圆形按钮并在其上制作标签

windows - 如何将 XLib key 代码转换为 Microsoft 虚拟 key ?

python - 如何在不知道子类名称的情况下访问 django 中对象的子类?

windows - 在 ShareX 中录制麦克风和系统声音

c - 在 Windows 和 Linux 上的 CMake 文件中链接数学库

本地计算机上的 Java Applet 获得 AccessControlExceptions,这取决于代码路径