54m
54m

Reputation: 767

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.

Upvotes: 0

Views: 6034

Answers (1)

iCart
iCart

Reputation: 2351

Use winsound.SND_ASYNC to make the call return immediatly:

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

Upvotes: 3

Related Questions