Sam Vruggink Sam Vruggink - 1 year ago 290
Python Question

How to play music in background Tkinter with winsound

I am trying to make a program and have the pokemon theme in the background while tkinter is running. But the program doesnt start before the song is over. How can I make that python keeps winsound active while running the rest of the program.'

winsound.PlaySound('song.wav', winsound.SND_ALIAS)

This is what I have. After this the code the whole program starts.

Answer Source

Use winsound.SND_ASYNC to make the call return immediatly:

winsound.PlaySound('song.wav', winsound.SND_ALIAS | winsound.SND_ASYNC)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download