System Beep?

MRAB python at mrabarnett.plus.com
Fri Mar 8 17:53:27 EST 2019


On 2019-03-08 22:11, Steve wrote:
> Import winsound
> winsound
> 
> No error, no beep either.
> 
You haven't called anything.

>>> import winsound
>>> dir(winsound)
['Beep', 'MB_ICONASTERISK', 'MB_ICONEXCLAMATION', 'MB_ICONHAND', 
'MB_ICONQUESTION', 'MB_OK', 'MessageBeep', 'PlaySound', 'SND_ALIAS', 
'SND_APPLICATION', 'SND_ASYNC', 'SND_FILENAME', 'SND_LOOP', 
'SND_MEMORY', 'SND_NODEFAULT', 'SND_NOSTOP', 'SND_NOWAIT', 'SND_PURGE', 
'__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__']
>>> help(winsound.Beep)
Help on built-in function Beep in module winsound:

Beep(frequency, duration)
     A wrapper around the Windows Beep API.

     frequency
       Frequency of the sound in hertz.
       Must be in the range 37 through 32,767.
     duration
       How long the sound should play, in milliseconds.

>>> winsound.Beep(200, 1000)

There's sound from the PC's sound system, but not from the internal 
speaker. (Is it even a speaker? It might be a piezo buzzer.)

> -----Original Message-----
> From: Python-list <python-list-bounces+gronicus=sga.ninja at python.org> On Behalf Of Peter Otten
> Sent: Friday, March 8, 2019 3:42 PM
> To: python-list at python.org
> Subject: RE: System Beep?
> 
> Steve wrote:
> 
>>> You have a typo. It is winsound, not winDsound.
> 
>> Yes, I saw that.  It still failed with, or without, the “d”.  I played 
>> with case and the use of (). They all produced similar errors
> 
> Did you import the winsound module before trying to use it?
> 
> --
> https://mail.python.org/mailman/listinfo/python-list
> 




More information about the Python-list mailing list