how to get a beep, OS independent ?

Diez B. Roggisch deets at nospam.web.de
Sun Dec 7 16:21:46 EST 2008


Peter Pearson schrieb:
> On Sun, 07 Dec 2008 00:40:53 +0100, Stef Mientki wrote:
>> 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 ?
> 
> Many people have suggested sending an ASCII 07 to your
> terminal window, but sometimes you don't have a terminal
> window.
> 
> Then there's the question of using the sound card versus
> using the PC speaker.  Too complicated for me.
> 
> I used a kluge: a short C program that beeps the way I want,
> in this case using ioctl(fd,KDMKTONE,arg) on /dev/tty0 (this
> is Linux).  The program has enough privileges to execute
> even when run by unprivileged users, and of course can be
> invoked by whatever language you're working in.

This can be done with python also, no need for C. See the module fcntl. 
The privilege-problem persists of course.


Diez



More information about the Python-list mailing list