3c273 wrote: > Hello, > I was trying to use the MessageBeep fuction to play different system sounds, > but using the syntax in the docs, all I can get is the default sound.. While > I finally got my sounds to play using PlaySound, I am curious as to what I > was doing wrong with MessageBeep. (Win2000 & XP) > > From the docs > > MessageBeep( [type=MB_OK]) > > ...The type argument specifies which sound to play; possible values are -1, > MB_ICONASTERISK, MB_ICONEXCLAMATION, MB_ICONHAND, MB_ICONQUESTION, and > MB_OK, all described below > > Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. >>>> import winsound >>>> winsound.MessageBeep(-1) > (This works) > >>>> winsound.MessageBeep(MB_OK) > Traceback (most recent call last): > File "<stdin>", line 1, in ? > NameError: name 'MB_OK' is not defined > > (OK I'm kind of new to this so maybe it needs quotes:-) > >>>> winsound.MessageBeep('MB_OK') > Traceback (most recent call last): > File "<stdin>", line 1, in ? > TypeError: an integer is required > > So what do I need to do to play the other sounds listed in the docs (using > MessageBeep). Thanks. > > Louis > > You need to call winsound.MessageBeep(winsound.MB_OK)
(e.g. MB_OK isn't automatically bound to anything). I tried all of the different sounds and they are different on my machine with the default sounds turned on. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list