Exemple #1
0
    def _play_button_hit(self):
        """Method contains actions when play button hit"""
        if pygame_music.get_pos() == -1:
            pygame_music.load(self._filepath)

            current_track = pygame_Sound(self._filepath)
            self._time_scale['to'] = current_track.get_length()
            self._play_button['text'] = 'Stop'

            pygame_music.play()
            pygame_music.set_pos(float(self._time_scale_var.get()))
        elif self._paused:
            self._play_button['text'] = 'Stop'
            pygame_music.unpause()
            self._paused = False
        else:
            self._play_button['text'] = 'Play'
            pygame_music.pause()
            self._paused = True
Exemple #2
0
 def set_music_pos(self, pos: float):
     music.set_pos(pos)
Exemple #3
0
 def _time_scale_moved(new_position):
     """Method contains actions when time scale moved"""
     if pygame_music.get_pos() != -1:
         pygame_music.set_pos(float(new_position))
Exemple #4
0
 def elapsed(self, new_pos: float) -> None:
     new_pos = clamp(0, new_pos, self.length)
     pgmusic.set_pos(new_pos)
     self.offset = (pgmusic.get_pos() / 1000) - new_pos