watch your logic, unpause never executes (except in the rare cases when the calls to get_busy gets a different response)
On Sun, May 7, 2017 at 2:34 PM, toufik <belaalatou...@gmail.com> wrote: > Hello. > This is my first e-mail in this mailling list. > I've a project using python 2.7 and pygame. The problem is > I've a button when I press it the music played and when I press it again > the music paused , but when I press the button in a third time the music > does not unpause > Any help please and I'm so sorry for the mistakes in writing . > > played = True > > def holder(): > time.sleep(0.001) > > def play(track): > global played > pygame.mixer.init() > pygame.mixer.music.load(track) > t = wx.PyTimer(holder) > if played : > pygame.mixer.music.play() > played = False > elif pygame.mixer.music.get_busy(): > pygame.mixer.music.pause() > elif not pygame.mixer.music.get_busy(): > pygame.mixer.music.unpause() > else: > played = True > t.Start(10) > > >