March 2018
Beginner to intermediate
422 pages
10h 33m
English
While we had defined the code for fast forward and rewind in the Player class, we did not define the method related to next track and previous track there, because this can be handled by the existing play method. All that you need to do is simply increment or decrement the value of current_track and then call the play method. Accordingly, define two methods in the View class, as follows (see code 5.04—view.py):
def play_previous_track(self): self.current_track_index = max(0, self.current_track_index - 1) self.start_play() def play_next_track(self): self.current_track_index = min(self.list_box.size() - 1, self.current_track_index + 1) self.start_play()
Then, simply attach these two methods to ...
Read now
Unlock full access