<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    I eventually managed to solve my problem. In case somebody
    encounters the same or a similar one, I provide my solution: I used
    a Python script iterating over the groups. Apparently, it is not
    possible (or I failed) to refresh the mapCanvas during the Python
    script. <br>
    <br>
    Instead of using  <code><span class="pln">"legend</span><span
        class="pun">.</span><span class="pln">setLayerVisible</span><span
        class="pun">(</span><span class="pln">layer</span><span
        class="pun">,</span><span class="pln"> </span><span class="kwd">True</span><span
        class="pun">)", I played with symbols:<br>
        <br>
        layers[2*g].rendererV2().symbol().setWidth(2)<br>
        layers[2*g].rendererV2().symbol().setAlpha(1)<br>
        <br>
        There were others problems in my code but the main difficulty
        lied there. Symbols can be updated during Python scripts and it
        perfectly meets my needs.<br>
        <br>
        Regards,<br>
        <br>
        Benoît<br>
      </span></code>
  
<br /><br />
<hr style='border:none; color:#909090; background-color:#B0B0B0; height: 1px; width: 99%;' />
<table style='border-collapse:collapse;border:none;'>
        <tr>
                <td style='border:none;padding:0px 15px 0px 8px'>
                        <a href="http://www.avast.com/">
                                <img border=0 src="http://static.avast.com/emails/avast-mail-stamp.png" />
                        </a>
                </td>
                <td>
                        <p style='color:#3d4d5a; font-family:"Calibri","Verdana","Arial","Helvetica"; font-size:12pt;'>
                                L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
                                <br><a href="http://www.avast.com/">www.avast.com</a>
                        </p>
                </td>
        </tr>
</table>
<br />
</body>
</html>