[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] toggle between play pause and unpause
- To: pygame-users@xxxxxxxx
- Subject: [pygame] toggle between play pause and unpause
- From: toufik <belaalatoufik@xxxxxxxxx>
- Date: Sun, 7 May 2017 18:34:27 +0100
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Sun, 07 May 2017 13:34:31 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=/rmUkiGXbM87FuWEFjVUzh5llBHrWzUPW2zqgmeuarE=; b=UwB8WwsSHJTLKlmzkfu8RmQKW10h3/PejmX4CFvSzrIuSqpmdL42vKa5U0FB1+RPVi jvhDuQ21Q66Iws2PaeIEvjRnG5Oy+g9fjUHwGE4N9y+uV5nzu4UbFN+woH4DgmqGZDrT +fnmlp+AySHKNgVXvR2TLdpWzK8qwejyeIv19xVeQP7+V+XT+cAc7K/Wmrh6wglgyC/X SSajMU9Q8ZHw8bcp+NRncAifUt1rCUBppQAnDUdHjXSNEUrgBVVW86sncnpDfWRMni3Q Jbn83xnZgZNtxYcx2CnBXUvxo3BpxXMMzPs0CEttDg1x9R7slEBqfAYxhjk4Z9nvqtZe t9AA==
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
- User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0
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)