import pygame |
# 音乐的路径 |
file1 = r 'E:\SLANDER、Dylan Matthew - Love is gone (Justin Dai & Marvin Bootleg) (Marvin remix).mp3' |
# 初始化 |
pygame.mixer.init() |
# 加载音乐文件 |
track = pygame.mixer.music.load(file1) |
# 开始播放音乐流 |
pygame.mixer.music.play() |
while True : |
# 检查音乐流播放,有返回True,没有返回False |
# 如果没有音乐流则选择播放 |
if pygame.mixer.music.get_busy() = = False : #检查是否正在播放音乐 |
if playMusic = = 0 : |
pygame.mixer.music.play() |