<?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 Python - Remove quotation marks from combobox. in Python AddIns Questions</title>
    <link>https://community.esri.com/t5/python-addins-questions/python-remove-quotation-marks-from-combobox/m-p/727854#M1</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for looking at my question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;This is my first time working with Python so I am on the learning curve.&amp;nbsp; I am creating a menu and I am populating a combo box from a field in a feature class in a file geodatabase.&amp;nbsp; It works thought the data retrieved needs cleaned up, I have tried a few different way to retrieve the data and I get the same results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to populate the combo box with map numbers, which I do get....&amp;nbsp; I want to see the map numbers looking like 01-01-01, etc.&amp;nbsp; I get [[(u'01-01-01',),.&amp;nbsp; I realize the [[ brackets are because I am putting the data is a list.&amp;nbsp; Not sure on the rest of it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following is my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from tkinter import ttk&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cursor = arcpy.da.SearchCursor("R:\Projects\MAP_Projects.gdb\MAP_INDEX","Map_No")&lt;BR /&gt;list1 = []&lt;BR /&gt;for row in cursor:&lt;BR /&gt; list1.append(row)&lt;/P&gt;&lt;P&gt;list1.sort()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;comboMapBox = ttk.Combobox(root, width=15, values = [list1])&lt;BR /&gt;comboMapBox.grid(column=0, row=1)&lt;BR /&gt;comboMapBox.current(0)&lt;BR /&gt;comboMapBox.place(x=125,y=60)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for taking a look, I am pleased I at least have it working....somewhat.&amp;nbsp; I am just not sure what I am missing, or have not found yet in my searching of the internet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dale,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 May 2019 17:02:54 GMT</pubDate>
    <dc:creator>DaleShearer</dc:creator>
    <dc:date>2019-05-07T17:02:54Z</dc:date>
    <item>
      <title>Python - Remove quotation marks from combobox.</title>
      <link>https://community.esri.com/t5/python-addins-questions/python-remove-quotation-marks-from-combobox/m-p/727854#M1</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for looking at my question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;This is my first time working with Python so I am on the learning curve.&amp;nbsp; I am creating a menu and I am populating a combo box from a field in a feature class in a file geodatabase.&amp;nbsp; It works thought the data retrieved needs cleaned up, I have tried a few different way to retrieve the data and I get the same results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to populate the combo box with map numbers, which I do get....&amp;nbsp; I want to see the map numbers looking like 01-01-01, etc.&amp;nbsp; I get [[(u'01-01-01',),.&amp;nbsp; I realize the [[ brackets are because I am putting the data is a list.&amp;nbsp; Not sure on the rest of it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following is my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from tkinter import ttk&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cursor = arcpy.da.SearchCursor("R:\Projects\MAP_Projects.gdb\MAP_INDEX","Map_No")&lt;BR /&gt;list1 = []&lt;BR /&gt;for row in cursor:&lt;BR /&gt; list1.append(row)&lt;/P&gt;&lt;P&gt;list1.sort()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;comboMapBox = ttk.Combobox(root, width=15, values = [list1])&lt;BR /&gt;comboMapBox.grid(column=0, row=1)&lt;BR /&gt;comboMapBox.current(0)&lt;BR /&gt;comboMapBox.place(x=125,y=60)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for taking a look, I am pleased I at least have it working....somewhat.&amp;nbsp; I am just not sure what I am missing, or have not found yet in my searching of the internet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dale,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2019 17:02:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-addins-questions/python-remove-quotation-marks-from-combobox/m-p/727854#M1</guid>
      <dc:creator>DaleShearer</dc:creator>
      <dc:date>2019-05-07T17:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: Python - Remove quotation marks from combobox.</title>
      <link>https://community.esri.com/t5/python-addins-questions/python-remove-quotation-marks-from-combobox/m-p/727855#M2</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The search cursor returns a tuple.&amp;nbsp; Try taking the first element in the tuple:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;list1 = [] 
cursor = arcpy.da.SearchCursor("R:\Projects\MAP_Projects.gdb\MAP_INDEX","Map_No")
    for row in cursor:
        list1.append(row[0]) # take first element in row

list1.sort()‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:07:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-addins-questions/python-remove-quotation-marks-from-combobox/m-p/727855#M2</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-12T07:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: Python - Remove quotation marks from combobox.</title>
      <link>https://community.esri.com/t5/python-addins-questions/python-remove-quotation-marks-from-combobox/m-p/727856#M3</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply, though I still got the same result.&amp;nbsp; I did more searching on the internet in relation to removing the brackets and quotation marks though the results are more applicable to removing characters from a string, not from a combo box.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So still searching, you think it would be a simple process.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2019 19:23:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-addins-questions/python-remove-quotation-marks-from-combobox/m-p/727856#M3</guid>
      <dc:creator>DaleShearer</dc:creator>
      <dc:date>2019-05-07T19:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: Python - Remove quotation marks from combobox.</title>
      <link>https://community.esri.com/t5/python-addins-questions/python-remove-quotation-marks-from-combobox/m-p/727857#M4</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, I found something just by trying different things.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I do the following I get the map number in the format I want, 01-01-01, but only 1 map number, not all the map numbers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;The following is my code:&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;from tkinter import ttk&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;cursor = arcpy.da.SearchCursor("R:\Projects\MAP_Projects.gdb\MAP_INDEX","Map_No")&lt;BR /&gt;list1 = []&lt;BR /&gt;for row in cursor:&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;comboMapBox['values'] = row&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;comboMapBox = ttk.Combobox(root, width=15)&lt;BR /&gt;comboMapBox.grid(column=0, row=1)&lt;BR /&gt;comboMapBox.current(0)&lt;BR /&gt;comboMapBox.place(x=125,y=60)&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;I know I am only setting the value to the last read value, so????&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2019 19:41:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-addins-questions/python-remove-quotation-marks-from-combobox/m-p/727857#M4</guid>
      <dc:creator>DaleShearer</dc:creator>
      <dc:date>2019-05-07T19:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: Python - Remove quotation marks from combobox.</title>
      <link>https://community.esri.com/t5/python-addins-questions/python-remove-quotation-marks-from-combobox/m-p/727858#M5</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay, the problem is not a combo box problem, but how the data is retrieved.&amp;nbsp; When I loop through the cursor (for row in cursor) and do print row each record is formatted the same, number is different: (u'01-01-01',)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I need to figure out how remove the: ( u ' , ) from the number.&amp;nbsp; It is a text field, but I have not been able to strip it as it loops through the cursor and appends it to the list.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2019 20:19:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-addins-questions/python-remove-quotation-marks-from-combobox/m-p/727858#M5</guid>
      <dc:creator>DaleShearer</dc:creator>
      <dc:date>2019-05-07T20:19:43Z</dc:date>
    </item>
    <item>
      <title>Re: Python - Remove quotation marks from combobox.</title>
      <link>https://community.esri.com/t5/python-addins-questions/python-remove-quotation-marks-from-combobox/m-p/727859#M6</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, that was a long trip from here to there....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'u' signifies unicode, learned that....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So in the spirit of just keep digging I came across where I need to return the ascii version of the string.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Added:&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;[0].encode("utf-8") to the append statement.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Was:&amp;nbsp;&amp;nbsp;list1.append(row)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Now:&amp;nbsp;&amp;nbsp;list1.append(row[0].encode("utf-8"))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for row in cursor:&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;list1.append(row[0].encode("utf-8"))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I now have the format of 01-01-01 in my combo box instead of&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(u'01-01-01',).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;I hope this helps someone else out.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2019 20:42:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-addins-questions/python-remove-quotation-marks-from-combobox/m-p/727859#M6</guid>
      <dc:creator>DaleShearer</dc:creator>
      <dc:date>2019-05-07T20:42:30Z</dc:date>
    </item>
  </channel>
</rss>

