本文實例講述了python使用PyGame模塊播放聲音的方法。分享給大家供大家參考。具體實現方法如下:
1
2
3
4
5
|
import pygame pygame.init() pygame.mixer.music.load( "sound_file.ogg" ) pygame.mixer.music.play() pygame.event.wait() |
希望本文所述對大家的Python程序設計有所幫助。