I am trying to get a laughing track to play whenever you die in my text adventure game, I am using Python but since I have no clue how to use Tkinter on Python. I never used TKinter so I need some help. If you are wondering where the file is, It is in a folder I named Sound Files.
Asked
Active
Viewed 1,145 times
-2
-
2The [TKinter help page has a HelloWorld](https://docs.python.org/2/library/tkinter.html), did you try it? – Eduardo Santana Dec 19 '15 at 18:08
-
Search web or pypi.python.org for something like 'python play sound'. The sound functions in pygame are one possibility. – Terry Jan Reedy Dec 19 '15 at 19:51
2 Answers
1
Use winsound - it's built in.
import winsound
winsound.PlaySound('laugh.wav', winsound.SND_FILENAME)

Jonah Fleming
- 1,187
- 4
- 19
- 31
0
I will wager a guess and say there is not built-in facility for playing audio. I would suggest reviewing older answers to similar question: Play audio with Python
UPDATE
I see I was wrong. Python 3 appears to have some facilities: 22. Multimedia Services — Python 3.5.1 documentation
-
I believe you were right the first time. The 'audio' modules read and write sound files in various formats, but do not play them through a speaker (unless writing to a sound device works). – Terry Jan Reedy Dec 19 '15 at 19:52