0

I have the following function in a python program, also using tkinter. However, when executed, the messagebox() is activated while the player is still playing the playlist of clips. Is it possible to encapsulate (if that is the correct term) the below code within the function ViewFile() so it continues after done playing? MPV does give an ability to call a function after it is completed (will play with that), but would love to know the answer to this.

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!")
AKX
  • 152,115
  • 15
  • 115
  • 172
rfeyer
  • 29
  • 6
  • How are you interfacing with mpv here? What is `player`? – AKX Mar 08 '21 at 16:53
  • Also, it seems you're missing the actual call parentheses in `player.wait_for_playback` -- it should probably be `player.wait_for_playback()`? – AKX Mar 08 '21 at 16:53
  • TY - this is MPV: ''' player = mpv.MPV(wid=str(int(DisplayFrame.winfo_id())), hwdec = 'auto', input_default_bindings=True,input_vo_keyboard=True,osc=True)''' – rfeyer Mar 08 '21 at 17:14
  • I tried wait_for_playback() but it now did not allow the lbFrame.lower() to function - i.e.: lbFrame is now on top? I tried adding a print statement after the playback() and that worked! It did not print until playback was finished, Ty for that. – rfeyer Mar 08 '21 at 17:19

0 Answers0