[Tutor] help

Alan Gauld alan.gauld at btinternet.com
Thu Dec 27 18:30:50 CET 2012


On 27/12/12 12:07, Randy WhiteWolf wrote:

> Phthon Programming for the Absolute Beginner by Michael Dawson. I have
> copied the code verbatim below.
> # Sound the system bell
> print "\a"
 > ...
> raw_input ("\n\nPress the enter key to exit.")
> My problem is I hear no system bell; the enter doesn't respond by
> quitting the program;

How are you running the code?
I suspect you are using IDLE or Pythonwin or some other IDE?
These generally don't obey the standard escape character
conventions. And in fact not all terminals do either!

If you put the code in a text file called screen.py (or
whatever you prefer) and run it from the command line with

C:\Windows> python screens.py

You might see something more like the expected result.
But a lot depends on your OS and terminal software.
My Linux terminal doesn't ring a bell (or flash) for example.
Lesson: don't rely on terminal escape characters unless you know exactly 
what terminal your users will be using.

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



More information about the Tutor mailing list