<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to Set a Map Page Text Element Visibilty to False in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-set-a-map-page-text-element-visibilty-to/m-p/34462#M2678</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using data driven pages in which I want a text element only shown in the identified page.&lt;/P&gt;&lt;P&gt;However, when I change pages the text element is still visible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;import &lt;/SPAN&gt;arcpy
mxd = arcpy.mapping.MapDocument(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"CURRENT"&lt;/SPAN&gt;)

&lt;SPAN style="color: #808080; font-style: italic;"&gt;# The text element is a textbox
&lt;/SPAN&gt;elm = arcpy.mapping.ListLayoutElements(mxd, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"TEXT_ELEMENT"&lt;/SPAN&gt;, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"closeup"&lt;/SPAN&gt;)[&lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;]
currentpage = mxd.dataDrivenPages.currentPageID

&lt;SPAN style="color: #808080; font-style: italic;"&gt;# (PAGE NAME 220 Also Known As (PAGE NUMBER 193) Must refer to PAGE NUMBER when scripting.
&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;if &lt;/SPAN&gt;currentpage == &lt;SPAN style="color: #0000ff;"&gt;193&lt;/SPAN&gt;:
&amp;nbsp;&amp;nbsp;&amp;nbsp; elm.visible = &lt;SPAN style="color: #000080;"&gt;True
&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;elif &lt;/SPAN&gt;currentpage != &lt;SPAN style="color: #0000ff;"&gt;193&lt;/SPAN&gt;:
&amp;nbsp;&amp;nbsp;&amp;nbsp; elm.visible = &lt;SPAN style="color: #000080;"&gt;False
&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;
&lt;/SPAN&gt;arcpy.RefreshActiveView()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 21:20:24 GMT</pubDate>
    <dc:creator>DevinUnderwood2</dc:creator>
    <dc:date>2021-12-10T21:20:24Z</dc:date>
    <item>
      <title>How to Set a Map Page Text Element Visibilty to False</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-a-map-page-text-element-visibilty-to/m-p/34462#M2678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using data driven pages in which I want a text element only shown in the identified page.&lt;/P&gt;&lt;P&gt;However, when I change pages the text element is still visible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;import &lt;/SPAN&gt;arcpy
mxd = arcpy.mapping.MapDocument(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"CURRENT"&lt;/SPAN&gt;)

&lt;SPAN style="color: #808080; font-style: italic;"&gt;# The text element is a textbox
&lt;/SPAN&gt;elm = arcpy.mapping.ListLayoutElements(mxd, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"TEXT_ELEMENT"&lt;/SPAN&gt;, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"closeup"&lt;/SPAN&gt;)[&lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;]
currentpage = mxd.dataDrivenPages.currentPageID

&lt;SPAN style="color: #808080; font-style: italic;"&gt;# (PAGE NAME 220 Also Known As (PAGE NUMBER 193) Must refer to PAGE NUMBER when scripting.
&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;if &lt;/SPAN&gt;currentpage == &lt;SPAN style="color: #0000ff;"&gt;193&lt;/SPAN&gt;:
&amp;nbsp;&amp;nbsp;&amp;nbsp; elm.visible = &lt;SPAN style="color: #000080;"&gt;True
&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;elif &lt;/SPAN&gt;currentpage != &lt;SPAN style="color: #0000ff;"&gt;193&lt;/SPAN&gt;:
&amp;nbsp;&amp;nbsp;&amp;nbsp; elm.visible = &lt;SPAN style="color: #000080;"&gt;False
&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;
&lt;/SPAN&gt;arcpy.RefreshActiveView()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:20:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-a-map-page-text-element-visibilty-to/m-p/34462#M2678</guid>
      <dc:creator>DevinUnderwood2</dc:creator>
      <dc:date>2021-12-10T21:20:24Z</dc:date>
    </item>
  </channel>
</rss>

