PyScripter - 无法终止使用 KeyboardInterrupt 运行

发布于 2024-08-21 02:57:26 字数 253 浏览 2 评论 0原文

我编写了很多我使用的小应用程序,

try:
   print "always does this until I Ctrl+C"


Except KeyboardInterrupt:
   print "finish program"

我刚刚开始放弃使用 IDLE 并启动 PyScripter。但是 CTRL+C 不再起作用。使用内置解释器时是否仍然可以发送KeyboardInterrupt

I write alot of small apps where I use

try:
   print "always does this until I Ctrl+C"


Except KeyboardInterrupt:
   print "finish program"

I've just began to move away from using IDLE and booted up PyScripter. However CTRL+C no longer works. Is it possible to still send in a KeyboardInterrupt while using the built-in interpreter?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

音盲 2024-08-28 02:57:26

在 PyScripter 中,如果您只想终止正在运行的程序,您可以随时重新初始化远程引擎:

  • Application Run Menu > Python引擎>重新初始化 Python 引擎或
  • 解释器上下文菜单 > Python引擎>重新初始化 Python 引擎或
  • 键盘快捷键 CTRL-F2

来源,Psyscripter 作者

In PyScripter if you just want to terminate a running program you can always re-initialize the remote engine:

  • Application Run Menu > Python Engine > Reinitialize Python Engine or
  • Interpreter context menu > Python Engine > Reinitialize Python Engine or
  • Keyboard shortcut CTRL-F2

Source, Psyscripter Author

枕梦 2024-08-28 02:57:26

我一直在回答我自己的问题,但我相信它们是有效的。PyScripter

google 小组有一种实现,他们导入进度条并杀死它,模拟中断。然而,这与键盘中断不同。看来在新的实施之前我运气不好。

话虽如此,任何人都可以建议另一种新颖的方式来由用户自行决定终止程序(不使用线程:p)吗?

I keep answering my own questions, but I believe they are valid..

The PyScripter google group has one implementation where they import a progress bar and kill it, simulating an interrupt. however, this is not the same as a keyboard interrupt. Looks like i'm out of luck until a new implementation.

Having Said That, can anyone suggest another novel way to terminate programs at a user's discretion (without using threads :p)?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文