Video player by Python tkinter, When I pause video, I cannot re-play Video player by Python tkinter, When I pause video, I cannot re-play tkinter tkinter

Video player by Python tkinter, When I pause video, I cannot re-play


Question: Pause button will have no effect.

Reference:


To cancel the allready queued events for self.play_video change the following:

def play_video(self):    ...    if self.pause:        self.window.after_cancel(self.after_id)    else:        self.after_id = self.window.after(self.delay, self.play_video)


I would create another method for the play button callback. Something like this:

def play_start(self):    self.pause = False    self.play_video()

However, I would make sure you disable the play button if it's already playing. Otherwise, you could have multiple "instances" of play_video going if the play button is pressed multiple times.


An alternative is to combine your play and pause button, so it toggles the value of self.pause. Then you could have just one button with one callback function.


Simply add in the play_video(self) method:

if self.pause == True:    self.pause = False    return