[Tutor] Multiple flags using winsound...

dman dsh8290@rit.edu
Tue, 24 Jul 2001 12:20:53 -0400


On Wed, Jul 25, 2001 at 02:11:55AM +1000, itchy shin wrote:
|  Hi I am new here and just started programming in
| Python.
| 
|  I was playing around with a module called winsound
| and got to play some wave sound using 1 flag but when
| I try to use multiple flags I get an error. Can
| someone please point out what I am doing wrong?
| 
| This worked:
| import winsound
| winsound.PlaySound("C:\\path\\whatever.wav",
| winsound.SND_ASYNCLOOP)
| 
| This gave a type error(PlaySound() takes exactly 2
| arguments (3 given)):
| import winsound
| winsound.PlaySound("C:\\path\\whatever.wav",
| winsound.SND_ASYNC, winsound.SND_LOOP)

Try this :

winsound.PlaySound("C:\\path\\whatever.wav",
    winsound.SND_ASYNC | winsound.SND_LOOP)

flags are commonly just bit patterns and you need to use a bitwise or
operation to combine both patterns together.

Also be aware that Win9x ignores any parameters sent to it (I think
that is with the Beep function, but I don't remember exactly).

-D