[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] toggle between play pause and unpause
- To: pythonist12@xxxxxxxxx, pygame mirror on google groups <pygame-mirror-on-google-groups@xxxxxxxxxxxxxxxx>
- Subject: Re: [pygame] toggle between play pause and unpause
- From: Sam Bull <sam.hacking@xxxxxxxx>
- Date: Mon, 08 May 2017 10:56:54 +0100
- Cc: pygame-users@xxxxxxxx
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Mon, 08 May 2017 05:57:04 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sent.com; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=rbDi+chWzYRrDuksSuCEBT1w5YmJ4I+I74Ko1neIE Ag=; b=bpxjNZdXEVGN9XOVdLN+McfDwyS4p3rVPtKtnPfwh+jb55yADRGqj4MRs 2cJgWPrzfZbCfugh6anqPZnmHQcpAJcJWVGG1Bvs+wxZRHc0EvV+f84XmNtBjls5 tTBvLaCKwXrWn1KU7tUze66FSe4WV/TY8LoAyM+2FYFQO3YdDDtzPAQltBhYyjQV kuQczmAkPl00OV68H1L1nmgechSqvc/cejuZlOKT+Ar6ZTE49363oxJLrJIFxJqN qKHA7T1FX6Ys8HPERLkxyMdht7NcdINOrlRxcJlEW6IpWgj1xAwQ/jt4ZR2ALrtt hk8is2ZDwp66qRSv1JKxjQqiqb40w==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=rbDi+chWzYRrDuksSu CEBT1w5YmJ4I+I74Ko1neIEAg=; b=i2kfDZQ8FInMJ4pc33BfYMjvIH5bh3z5gY kZ5N8AZxt1fzr8Q4rZg/vPAlYcyRxfScU5OILy9/sYwvnCsdGyggcHN6cer874uA J2pt3GHi7WheM1royZhnvNzxSixtvU67cpWloavHM7k1t1vvkwf1p1yVfzHNxwW9 wwr70Mpcugd1WO95RwgbIvrxYUylRQw/qUhawBd7IWnqGBANEzgdgc4T44aNMxc1 +irC9DVRTfy9awBKN2TtX6brY8UyPXffJjvn3loZAYhPs9bA+a50va2NuYHMqQWP zZGzmJMCQ+8wVvt+CSFpWrbWG0UlUsR2R+40b9mFdkf6oIYUCaHA==
- In-reply-to: <c72fcf95-b243-4575-bb49-fc2a4ea165de@googlegroups.com>
- References: <590F5AA3.70107@gmail.com> <1494186149.5759.9.camel@sent.com> <a372f44a-e798-4543-a89e-c0d3070cb136@googlegroups.com> <1494190103.5759.13.camel@sent.com> <fc51e915-30e7-4250-a925-abacfb2257f9@googlegroups.com> <1494198312.5759.17.camel@sent.com> <ecc9bb1a-a147-4dce-b5e2-bdb8966b729a@googlegroups.com> <1494234674.8714.2.camel@sent.com> <c72fcf95-b243-4575-bb49-fc2a4ea165de@googlegroups.com>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
From the docs:
get_endevent(): Returns the event type to be sent every time the
music finishes playback. If there is no endevent the function
returns pygame.NOEVENT.
Therefore this has nothing to do with whether the music has stopped or
not.
With your other init code, you will want to run something like:
from pygame.locals import *
MUSICENDEVENT = USEREVENT
set_endevent(MUSICENDEVENT)
And in your event loop:
if event.type == MUSICENDEVENT:
started = False
On Mon, 2017-05-08 at 02:47 -0700, pythonist12@xxxxxxxxx wrote:
> Thank you very much now the track is pausing .But there is final
> problem I want to replay the music more than onece
> How can I fix it, I used this code after else block :
> if pygame.mixer.music.get_endevent():
> playing = False
> started = False
Attachment:
signature.asc
Description: This is a digitally signed message part