The another python winsound function is winsound.MessageBeep(type=MB_OK)
This plays a sound as specified in the registry. The type argument specifies which sound to play; possible values are -1 , MB_ICONASTERISK, MB_ICONEXCLAMATION, MB_ICONHAND, MB_ICONQUESTION ,MB_OK all described below. The value -1 produces a “simple beep”; this is the final fallback if a sound cannot be played otherwise. If the system indicates an error,
General syntax for winsound.MessageBeep() is
winsound.MessageBeep(type=MB_OK)
Here, type is a winsound.MB_ value that specifies which system sound to play. The following table summarizes the sounds available:
winsound values Corresponding Control Panel Sound
MB_ICONASTERISK Asterisk
MB_ICONEXCLAMATION Exclamation
MB_ICONHAND Critical Stop
MB_ICONQUESTION Question
MB_OK System Default
NOTE: if -1 is passed then the default beep is played
#code
import winsound
winsound.MessageBeep(winsound.MB_ICONHAND)
#In the example above, the Critical Stop built-in sound is played using the MessageBeep function.
winsound.MessageBeep(winsound.MB_ICONASTERISK)
#In the example above, the Asterisk built-in sound is played using the MessageBeep function.
winsound.MessageBeep(winsound.MB_ICONEXCLAMATION )
#In the example above, the Exclamation built-in sound is played using the MessageBeep function.
winsound.MessageBeep(winsound.MB_ICONQUESTION )
#In the example above, the Question built-in sound is played using the MessageBeep function.
winsound.MessageBeep(winsound.MB_OK )
#In the example above, the System Default built-in sound is played using the MessageBeep function.
winsound.MessageBeep(-1 )
#In the example above, the Default built-in sound is played using the MessageBeep function.
x
Comments