问题描述
我已经制作了一个音乐播放器,我想在歌曲结束后播放无限循环,并且歌曲是随机歌曲(从选定文件夹播放的歌曲),所以我想在{{1 }}。我已经尝试了很多,但无法执行此循环。
请帮助我解决这个问题
这是我的代码
random_music(local variable)
random_music = ''
mfile=''
def Play(event=None):
global random_music,mfile
if (shuffleUnshuffleBtn['text'] == ''):
mfile= MUSIC_FILE+'/../'
print("Shuffle")
print(mfile)
songs =os.listdir(mfile)
noOfSongs=len(songs)
listofSongsInDir = [i for i in range(1,noOfSongs)]
print(songs)
print(len(songs))
print(listofSongsInDir)
random_music = random.choice(songs)
while (progressbar_music_starttime==progressbar_music_startend):
print(random.choice(songs))
#random_music = random.choice(songs)
# sleep()
print(random_music)
c=(os.path.join(mfile,random_music))
# i+=1
mixer.init()
# ad=audiotrack.get()
mixer.music.load(c)
print(c)
progressbar_Ibl.place()
mixer.music.play()
progressbar_music_label.place()
song=MP3(mfile+random_music)
是一首由用户选择的歌曲
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)