[Tutor] Visual and audible system bell

Alan Gauld alan.gauld at btinternet.com
Mon Dec 12 09:18:51 CET 2011


On 12/12/11 07:57, David Smith wrote:

> In a terminal window
>>>>> print ("\a")
>
> triggers a visual and audible bell as set in Terminal window preferences.
>
> However
>
>>>>> print ("\a")
> and pressing Enter in a Python Shell window
> results in neither a visible nor an audible system bell.

I assume the second case means an IDLE window?
If so then its not surprising because IDLE does not use the Terminal 
settings. It is its own Terminal. And IDLE intercepts many of the 
standard control keys etc. In general this is a good thing since IDLE is 
trying to make  debugging and testing code as easy as possible so it 
prevents premature exit from IDLE. But occasionally it stops things 
happening the way you want. In this case no bell. (It is worth perusing 
the IDLE config settings, it may be possible to change this, but I 
suspect its more deeply embedded in the code than that)

The only way round it is probably to just test your code by running it 
in a Terminal and just use IDLE for editing and debugging.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list