I am trying to write a python script for a tool that lets you toggle the labels for specific feature classes using Boolean values. My question is how can I get the labels to turn on or off? I've seen examples of people using the variable.showLabels = True to get their labels to display but for me it did not work. Any help is greatly appreciated.
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>turnLabelsOnOff <SPAN class="operator token">==</SPAN> <SPAN class="token boolean">True</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">and</SPAN> <SPAN class="punctuation token">(</SPAN>layer <SPAN class="keyword token">in</SPAN> layerList<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
layer<SPAN class="punctuation token">.</SPAN>showLabels <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">True</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>turnLabelsOnOff <SPAN class="operator token">==</SPAN> <SPAN class="token boolean">False</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">and</SPAN> <SPAN class="punctuation token">(</SPAN>layer <SPAN class="keyword token">in</SPAN> layerList<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
layer<SPAN class="punctuation token">.</SPAN>showLabels <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">False</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>turnLabelsOnOff <SPAN class="operator token">==</SPAN> <SPAN class="token boolean">True</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">and</SPAN> <SPAN class="punctuation token">(</SPAN>layer <SPAN class="keyword token">in</SPAN> layerList<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
layer<SPAN class="punctuation token">.</SPAN>showLabels <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">True</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>turnLabelsOnOff <SPAN class="operator token">==</SPAN> <SPAN class="token boolean">False</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">and</SPAN> <SPAN class="punctuation token">(</SPAN>layer <SPAN class="keyword token">in</SPAN> layerList<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
layer<SPAN class="punctuation token">.</SPAN>showLabels <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">False</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>