简体   繁体   English

如何在IDLE或Pydev中打印'\\ 007'或'\\ a'(哔哔声)

[英]How to print a '\007' or '\a' (beep) in IDLE or Pydev

env: ENV:

  • windows 7 English 32bit Windows 7英文32位
  • Python 2.7.3 Python 2.7.3

I can print beep in IPython, but in Pydev or IDLE, it doesn't work. 我可以在IPython中打印蜂鸣声,但在Pydev或IDLE中,它不起作用。
It only print an unrecognized char but not make a beep sound. 它只打印一个无法识别的字符但不发出哔声。
Why? 为什么?
Thanks. 谢谢。

The ASCII BEL character only sounds a bell where a bell is supported. ASCII BEL字符仅响起支持铃声的铃声。 Many terminals and terminal emulators do give this special meaning to the BEL character, but as you noticed, IDLE and Pydev do not. 许多终端和终端模拟器确实赋予BEL角色这种特殊含义,但正如你所注意到的,IDLE和Pydev没有。 It is not necessarily a bug, but merely a missing feature. 它不一定是一个bug,而只是一个缺失的功能。

It doesn't beep because it's up to the terminal to interpret \\a for you, and IDLE and Pydev don't interpret it as an auditory beep. 它没有发出哔哔声,因为终端要为你解释\\a ,IDLE和Pydev不会把它解释为听觉的嘟嘟声。

If you just want to produce a beep, take a look at the winsound standard library module. 如果您只想发出一声蜂鸣声,请查看winsound标准库模块。 If you want to get IDLE or Pydev to interpret BEL as a beep, you're probably out of luck. 如果你想让IDLE或者Pydev将BEL解释为哔哔声,你可能会失败。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM