<div dir="ltr">Ok, saludos y happy coding!!!<br></div><div class="gmail_extra"><br><div class="gmail_quote">2014-12-03 22:02 GMT-02:00 Diego Caraballo <span dir="ltr"><<a href="mailto:dcaraballo@amsj.com.uy" target="_blank">dcaraballo@amsj.com.uy</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div style="font-family:Verdana,Geneva,sans-serif">
<p>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.</p>
<p>Muchas gracias también Grabriel Fernandez por tu respuesta.</p>
<p>Saludos</p>
<p> </p>
<p>El 2014-12-03 12:57, Python escribió:</p><div><div class="h5">
<blockquote type="cite" style="padding-left:5px;border-left:#1010ff 2px solid;margin-left:5px">
<div>Buenas,<br> Creo que el comando play tiene un parámetro para indicarle que repita el fichero continuamente. loops = -1<br> Por lo que no hace falta ningún while.<br><br><tt style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:bold;font-style:inherit;font-size:1.1em;font-family:inherit;vertical-align:baseline">pygame.mixer.music.</tt><tt style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:bold;font-style:inherit;font-size:1.1em;font-family:inherit;vertical-align:baseline">play</tt><big style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-size:16px;font-family:inherit;vertical-align:baseline">(</big><big style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-size:16px;font-family:inherit;vertical-align:baseline">)</big><br>
<div style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-size:16px;font-family:inherit;vertical-align:baseline">
<div style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-size:16px;font-family:inherit;vertical-align:baseline"><span style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:italic;font-size:16px;font-family:inherit;vertical-align:baseline">Start the playback of the music stream</span></div>
<div style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-size:16px;font-family:inherit;vertical-align:baseline"><span style="margin:0px 0px 0.5em;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-size:13px;font-family:monospace;vertical-align:baseline">play(loops=0, start=0.0) -> None</span></div>
</div>
<p style="margin:0.5em 0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-size:16px;font-family:inherit;vertical-align:baseline;text-align:left;line-height:20.7999992370605px">This will play the loaded music stream. If the music is already playing it will be restarted.</p>
<p style="margin:0.5em 0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-size:16px;font-family:inherit;vertical-align:baseline;text-align:left;line-height:20.7999992370605px">The loops argument controls the number of repeats a music will play.<span> </span><tt style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-size:16px;font-family:inherit;vertical-align:baseline"><span style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-size:16px;font-family:inherit;vertical-align:baseline">play(5)</span></tt><span> </span>will cause the music to played once, then repeated five times, for a total of six. <strong>If the loops is -1 then the music will repeat indefinitely.</strong></p>
<p style="margin:0.5em 0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-size:16px;font-family:inherit;vertical-align:baseline;text-align:left;line-height:20.7999992370605px">The starting position argument controls where in the music the song starts playing. The starting position is dependent on the format of music playing.<span> </span><tt style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-size:16px;font-family:inherit;vertical-align:baseline"><span style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-size:16px;font-family:inherit;vertical-align:baseline">MP3</span></tt><span> </span>and<span> </span><tt style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-size:16px;font-family:inherit;vertical-align:baseline"><span style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-size:16px;font-family:inherit;vertical-align:baseline">OGG</span></tt><span> </span>use the position as time (in seconds).<span> </span><tt style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-size:16px;font-family:inherit;vertical-align:baseline"><span style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-size:16px;font-family:inherit;vertical-align:baseline">MOD</span></tt><span> </span>music it is the pattern order number. Passing a startpos will raise a NotImplementedError if it cannot set the start position</p>
<br> Saludos<br><br> El 03/12/2014 19:35, gabriel fernandez ha escrit:</div>
<blockquote type="cite" style="padding-left:5px;border-left:#1010ff 2px solid;margin-left:5px">
<div dir="ltr">
<div>
<div>
<div>
<div>Hola Diego, usa una variable de instancia en tu clase para que sirva de bandera, por ejemplo:<br><br></div>
class Algo:<br><br></div>
def __init__(self):</div>
self.flag_presionar_btn = False<br><br></div>
def btn_mi_clicked(self):<br> self.flag_presionar_btn = True<br> pygame.mixer.music.stop()<br> <br> while True:<br> pygame.mixer.init()<br> pygame.mixer.music.load("mi.
<div>mp3")<br> pygame.mixer.music.play()<br> time.sleep()<br> pygame.mixer.music.stop()<br><br> if not self.flag_presionar_btn:</div>
<div> break<br><br><br></div>
<div>No se si queda claro, espero te sirva, saludos!</div>
</div>
<div class="gmail_extra"> </div>
</blockquote>
</blockquote>
</div></div></div>
<br>_______________________________________________<br>
Python-es mailing list<br>
<a href="mailto:Python-es@python.org">Python-es@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-es" target="_blank">https://mail.python.org/mailman/listinfo/python-es</a><br>
FAQ: <a href="http://python-es-faq.wikidot.com/" target="_blank">http://python-es-faq.wikidot.com/</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Gabriel Fernández<br>Desrrollador Web<br><a href="http://www.openweb.com.uy" target="_blank">www.openweb.com.uy</a> <br><img src="http://www.openweb.com.uy/imagenes/logo-OPENWEB.jpg" height="39" width="420"><br></div>
</div>