How do play audio (playsound) in background of Python script?

前端 未结 6 791
慢半拍i
慢半拍i 2020-12-03 09:36

I am just writing a small python game for fun and I have a function that does the beginning narrative.

I am trying to get the audio to play in the background but unf

6条回答
  •  执笔经年
    2020-12-03 10:05

    Well you could just use pygame.mixer.music.play(x)

    #!/usr/bin/env python3
    # Any problems contact me on instagram @vulnerabilties
    import pygame
    
    pygame.mixer.init()
    pygame.mixer.music.load('filename.extention')
    pygame.mixer.music.play(999)
    # YOUR CODE HERE
    

提交回复
热议问题