beeping noise on windows

Bengt Richter bokr at oz.net
Mon Jan 28 16:10:39 EST 2002


On Mon, 28 Jan 2002 09:12:35 -0600, "Jason Orendorff" <jason at jorendorff.com> wrote:

>> back on my Apple II+ i could write the line
>> "print Ctrl-G"
>> and the computer would beep.  Is there a command as simple to make windows
>> beep for me? -- from python?
>
>http://www.python.org/doc/1.5.2p2/lib/module-winsound.html
>
>import winsound
>winsound.PlaySound(".Default", winsound.SND_ALIAS | winsound.SND_ASYNC)
>
>Other sounds are available:
>  "SystemAsterisk"
>  "SystemExclamation"
>  "SystemQuestion"
>  "MailBeep"
>  ...
>
>There's a list in your registry somewhere; search for SystemAsterisk.
>Use SND_FILENAME instead of SND_ALIAS if you want to specify which
>WAV file to play.
>
It might be worth mentioning that you also have the option of playing
the old-fashioned beep on the computer's speaker rather than through
the sound system. E.g.,

 >>> import winsound
 >>> winsound.Beep(440,250)

plays an "A" for 250 milliseconds on the computer's internal speaker.

(Note the upper case 'B' on 'Beep')

Regards,
Bengt Richter





More information about the Python-list mailing list