0

I am writing a simple game but when I try to use the winsound command to play some music, it will play it but everything after it doesn't work. I tried to put it in the end but then the music starts when I quit the game.

Jimi
  • 1,605
  • 1
  • 16
  • 33
Eliaz
  • 28
  • 2
  • Definitely your program must have control over windsound lib. So you must create any thread class that could handle that library from initialization, loading, ..., finalization, include all relevance events for that lib. – OO7 Feb 18 '20 at 16:40

1 Answers1

0

That's because, from what I understand, you are doing it synchronously, so the code execution will recover after the sound has been reproduced. Now, since I think you are referring the winsound python library, you should be able to run a thread where you play the sound using the Python Threading library. This way the sound is reproduced asynchronously while the rest of your code run

Jimi
  • 1,605
  • 1
  • 16
  • 33