[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] toggle between play pause and unpause



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