Hola, muchas gracias por tu respuesta, ha sido la que necesitaba. Poniendo loops = -1 el tono se repite y aparte puedo seguir interactuando con los demás botones.
Muchas gracias también Grabriel Fernandez por tu respuesta. Saludos El 2014-12-03 12:57, Python escribió: > Buenas, > Creo que el comando play tiene un parámetro para indicarle que repita el > fichero continuamente. loops = -1 > Por lo que no hace falta ningún while. > > pygame.mixer.music.play() > > Start the playback of the music stream > play(loops=0, start=0.0) -> None > > This will play the loaded music stream. If the music is already playing it > will be restarted. > > The loops argument controls the number of repeats a music will play. play(5) > will cause the music to played once, then repeated five times, for a total of > six. IF THE LOOPS IS -1 THEN THE MUSIC WILL REPEAT INDEFINITELY. > > The starting position argument controls where in the music the song starts > playing. The starting position is dependent on the format of music playing. > MP3 and OGG use the position as time (in seconds). MOD music it is the > pattern order number. Passing a startpos will raise a NotImplementedError if > it cannot set the start position > Saludos > > El 03/12/2014 19:35, gabriel fernandez ha escrit: > >> Hola Diego, usa una variable de instancia en tu clase para que sirva de >> bandera, por ejemplo: >> >> class Algo: >> >> def __init__(self): self.flag_presionar_btn = False >> >> def btn_mi_clicked(self): >> self.flag_presionar_btn = True >> pygame.mixer.music.stop() >> >> while True: >> pygame.mixer.init() >> pygame.mixer.music.load("mi. >> mp3") >> pygame.mixer.music.play() >> time.sleep() >> pygame.mixer.music.stop() >> >> if not self.flag_presionar_btn: >> break >> >> No se si queda claro, espero te sirva, saludos!
_______________________________________________ Python-es mailing list Python-es@python.org https://mail.python.org/mailman/listinfo/python-es FAQ: http://python-es-faq.wikidot.com/