how to get a beep, OS independent ?

George Sakkis george.sakkis at gmail.com
Sun Dec 7 19:53:58 CET 2008


On Dec 7, 7:49 am, Stef Mientki <stef.mien... at gmail.com> wrote:

> Chris Rebert wrote:
> > On Sun, Dec 7, 2008 at 1:27 AM, Stef Mientki <stef.mien... at gmail.com> wrote:
>
> >> Rainy wrote:
>
> >>> On Dec 6, 3:40 pm, Stef Mientki <stef.mien... at gmail.com> wrote:
>
> >>>> hello,
>
> >>>> I want to give a small beep,
> >>>> for windows there's message-beep,
> >>>> and there seems to be something like " curses" ,
> >>>> but that package seems to be totally broken in P2.5 for windows.
>
> >>>> Any other suggestions ?
>
> >>>> thanks,
> >>>> Stef Mientki
>
> >>> For win there's winsound, you have to check sys.platform and do
> >>> what's necessary for the platform in question. In linux I think
> >>> you can just print '\a' (or does that only work in terminals?).
> >>> If you know that ext. speakers are always on, you can do a nicer
> >>> beep by using some wav file, in linux it's probably easiest to
> >>> use an external program to play it, like wavplay. Basically,
> >>> there is no single answer, it depends on circumstances.
> >>> --
> >>>http://mail.python.org/mailman/listinfo/python-list
>
> >> '\a' or chr(7) prints an inverted "BEL".
>
> > Inverted bell?
>
> In the output window (stdout) which is black letters on white background,
> it prints "bell" in white letters with a black background.>  What do you mean? And what version dependency are you
> > referring to?
>
> Well some of you actually hear something,
> I don't,
> so I expect that the Python version differs.

Works for me on WinXP, Python 2.5:

C:\>python -c "print chr(7)"

makes a beep.

George



More information about the Python-list mailing list