how to get a beep, OS independent ?

Joe Strout joe at strout.net
Sun Dec 7 09:17:30 EST 2008


On Dec 7, 2008, at 6:36 AM, Duncan Booth wrote:

> Python is just printing the ascii bell character: some environments  
> will
> interpret that as a request to make a beep, some will do things like
> flashing the whole screen, others just output a graphic character.  
> Python
> doesn't know what your environment will do.

Agreed.

But invoking the standard system beep is such a basic function that it  
ought to be easier than this.  I'm pretty sure it's a single OS call  
on all platforms.  On OS X, for example, it's

   void NSBeep(void);

declared in NSGraphics.h.  I'm sure it's something similarly simple on  
other platforms.

Where's the standard place for this sort of OS-abstraction function,  
outside the standard Python library?  I'm talking about something more  
light-weight than wx, QT, or TK; something that just wraps standard  
functions (like the system beep) and works in console apps or in any  
flavor of GUI app.  Is there such a module out there somewhere?

Best,
- Joe





More information about the Python-list mailing list