<?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 Customizing the title font using ArcPy in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/customizing-the-title-font-using-arcpy/m-p/1486441#M84263</link>
    <description>&lt;P&gt;Hello I was wondering if someone knows how to customize the title font using ArcPy. This is my current code which was given on ArcPy Documentation under TextElement:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;txtStyleItem = p.listStyleItems('ArcGIS 2D', 'TEXT', 'Title (Serif)')[0]&lt;BR /&gt;ptTxt = p.createTextElement(lyt, arcpy.Point(11, 10), 'POINT', title_text, 6, style_item=txtStyleItem)&lt;BR /&gt;ptTxt.setAnchor('Center_Point')&lt;BR /&gt;ptTxt.elementPositionX = 8.5&lt;BR /&gt;ptTxt.elementPositionY = 10&lt;BR /&gt;ptTxt.textSize = 28&lt;/P&gt;&lt;P&gt;The issue is when I try to change 'Serif' to something else like 'Tahoma' I get an error:&lt;/P&gt;&lt;P&gt;In [10]:&lt;/P&gt;&lt;P&gt;Line 48: txtStyleItem = p.listStyleItems('ArcGIS 2D', 'TEXT', 'Title (Tahoma)' )[0]&lt;/P&gt;&lt;P&gt;IndexError: list index out of range&lt;/P&gt;&lt;P&gt;Does anyone know how to use ArcPy to change the font?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jun 2024 17:20:58 GMT</pubDate>
    <dc:creator>YahyaMasri</dc:creator>
    <dc:date>2024-06-06T17:20:58Z</dc:date>
    <item>
      <title>Customizing the title font using ArcPy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/customizing-the-title-font-using-arcpy/m-p/1486441#M84263</link>
      <description>&lt;P&gt;Hello I was wondering if someone knows how to customize the title font using ArcPy. This is my current code which was given on ArcPy Documentation under TextElement:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;txtStyleItem = p.listStyleItems('ArcGIS 2D', 'TEXT', 'Title (Serif)')[0]&lt;BR /&gt;ptTxt = p.createTextElement(lyt, arcpy.Point(11, 10), 'POINT', title_text, 6, style_item=txtStyleItem)&lt;BR /&gt;ptTxt.setAnchor('Center_Point')&lt;BR /&gt;ptTxt.elementPositionX = 8.5&lt;BR /&gt;ptTxt.elementPositionY = 10&lt;BR /&gt;ptTxt.textSize = 28&lt;/P&gt;&lt;P&gt;The issue is when I try to change 'Serif' to something else like 'Tahoma' I get an error:&lt;/P&gt;&lt;P&gt;In [10]:&lt;/P&gt;&lt;P&gt;Line 48: txtStyleItem = p.listStyleItems('ArcGIS 2D', 'TEXT', 'Title (Tahoma)' )[0]&lt;/P&gt;&lt;P&gt;IndexError: list index out of range&lt;/P&gt;&lt;P&gt;Does anyone know how to use ArcPy to change the font?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 17:20:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/customizing-the-title-font-using-arcpy/m-p/1486441#M84263</guid>
      <dc:creator>YahyaMasri</dc:creator>
      <dc:date>2024-06-06T17:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: Customizing the title font using ArcPy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/customizing-the-title-font-using-arcpy/m-p/1486546#M84273</link>
      <description>&lt;P&gt;I'm not 100% confident I understand your question but it looks to me like you're attempting to grab a style item that does not exist in this line:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; Line 48: txtStyleItem = p.listStyleItems('ArcGIS 2D', 'TEXT', 'Title (Tahoma)' )[0]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;and then use the "&lt;SPAN&gt;applyStyleItem (style_item)" method to change the text.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If this is the case I'd double check that you have a StyleItem called 'Title (Tahoma)'&lt;/P&gt;&lt;P&gt;If you're just trying to change the font of that text element you can do the same thing by using this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ptTxt.fontFamilyName = "Tahoma"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 19:26:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/customizing-the-title-font-using-arcpy/m-p/1486546#M84273</guid>
      <dc:creator>gpopulis</dc:creator>
      <dc:date>2024-06-06T19:26:01Z</dc:date>
    </item>
  </channel>
</rss>

