如何在函数内封装 MPV 播放器

问题描述

我在 python 程序中有以下函数,也使用 tkinter。 但是,当执行时,messageBox() 会在播放器仍在播放剪辑播放列表时被激活。 是否可以在函数 ViewFile() 中封装(如果这是正确的术语)以下代码,以便在播放完毕后继续? MPV 确实提供了在完成后调用函数的能力(将使用它),但很想知道这个问题的答案。

def ViewFile():
    player.stop()
    global directory
    selected_text_list = [lb.get(i) for i in lb.curselection()]
    lbFrame.lower()  ## lbFrame.lift() to raise back up
    for f in selected_text_list:
        path_and_file = directory + f
        player.playlist_append(path_and_file)
    player.playlist_pos = 0
    player.wait_for_playback
    messageBox.showinfo("Last one played!")

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)