我希望tkinter标签在音效完成后不显示任何内容。
我一直在研究如何创建/初始化/捕捉音乐事件的结束,但没有运气。
def play_btn():
if mixer.music.get_busy():
mixer.music.fadeout(1000)
snd_fyl.set(snd_list.get(ACTIVE))
mixer.music.load(snd_dir+"/"+snd_list.get(ACTIVE)+"mp3")
mixer.music.play()
def stop_btn():
mixer.music.stop()
clear_label()
def clear_label():
snd_fyl.set("")
snd_lbl1 = LabelFrame(MainWindow, text="Sound effect playing", labelanchor=N)
snd_playing_lbl = Label(snd_lbl1, width=40, textvariable=snd_fyl)
Run Code Online (Sandbox Code Playgroud)
显然,play_btn 函数从列表中播放声音效果。
该stop_btn函数提前停止音效并清除标签。
该clear_label函数已为end_of_song事件做好准备而创建
不试图做任何激烈的事情,但我正在从mp3标题标签重命名我的音乐文件.遇到一个文件这个问题: -
$fyl = One Vision [From the Motion Picture Iron Eagle].mp3
$tmp = "tmp.mp3"
$track_title = One vision [From the motion picture Iron Eagle]
rename-item "$mp3path$fyl" -newname "$mp3path$tmp"
rename-item "$mp3path$tmp" -newname "$mp3path$track_title.mp3"
Run Code Online (Sandbox Code Playgroud)
我收到错误: - 重命名 - 项目:无法重命名因为项目在'F:\ Music\Queen\Live Magic\One Vision [来自电影铁鹰] .mp3'不存在.
该文件存在!
我通过tmp.mp3,以防文件是相同的,如果没有区分大小写的话.
该代码适用于没有方括号的文件,因此很明显Powershell正在逐字逐句地使用它们.
我尝试用Move-Item替换Rename-Item,但是我得到了类似的错误.
任何帮助表示赞赏.