coding=utf-8
import time
import pygame
import os
def music_play():
pygame.mixer.init() # 初始化音频
track = pygame.mixer_music.load(file_path) # 音频载入
pygame.mixer_music.play() # 播放
pygame.mixer.music.set_volume(volume)
time.sleep(300)
pygame.mixer_music.stop()
file_path = ‘E:\音乐下载\陈雪凝 - 绿色.mp3’
music_name = os.path.split(file_path)[1]
volume=0.3
music_interface = “”"
_________________
|yunye的音乐播放器|
͞͞͞͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞
__________________________________
正在播放:{}
----------------------------------
""".format(music_name)
print(music_interface)
while True:
music_play()