O'Reilly logo

Tkinter GUI Application Development Blueprints - Second Edition by Bhaskar Chaudhary

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding the next track/previous track function

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.04view.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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required