<?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 Re: 10.2 Arcpy comboboxclass addin simple question in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650862#M50646</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Then you probably changed it manually. Check in the addin assistant what the ID is for your combo box class. All you need are in the help docs.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/combo_box/014p00000028000000/"&gt;http://resources.arcgis.com/en/help/main/10.2/index.html#/combo_box/014p00000028000000/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Mar 2014 20:19:00 GMT</pubDate>
    <dc:creator>MathewCoyle</dc:creator>
    <dc:date>2014-03-12T20:19:00Z</dc:date>
    <item>
      <title>10.2 Arcpy comboboxclass addin simple question</title>
      <link>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650859#M50643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hopefully this is a simple question,&amp;nbsp; what variable is used to get the selection from this combo box?&amp;nbsp; ie how do I use this in later code.&amp;nbsp; I am not finding any good resources for arcpy addins.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;class ComboBoxClass4(object): &amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for MTR_addin.combobox (ComboBox)""" &amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.value = "S"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.items = ("C", "F", "K", "S", "U")&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.editable = True &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.dropdownWidth = 'WWW' &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.width = 'WWW' &amp;nbsp;&amp;nbsp;&amp;nbsp; def onSelChange(self, selection): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass &amp;nbsp;&amp;nbsp;&amp;nbsp; def onEditChange(self, text): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass &amp;nbsp;&amp;nbsp;&amp;nbsp; def onFocus(self, focused): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass &amp;nbsp;&amp;nbsp;&amp;nbsp; def onEnter(self): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass &amp;nbsp;&amp;nbsp;&amp;nbsp; def refresh(self): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2014 18:04:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650859#M50643</guid>
      <dc:creator>jasongraham</dc:creator>
      <dc:date>2014-03-12T18:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: 10.2 Arcpy comboboxclass addin simple question</title>
      <link>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650860#M50644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You need to use the ID from the addin assistant. In your case it is called 'combobox'&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2014 19:15:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650860#M50644</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2014-03-12T19:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: 10.2 Arcpy comboboxclass addin simple question</title>
      <link>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650861#M50645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;You need to use the ID from the addin assistant. In your case it is called 'combobox'&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Nope, says combobox not defined.&amp;nbsp; Do you know of any better resources for arcpy addin, the python is different from scrpting&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2014 20:09:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650861#M50645</guid>
      <dc:creator>jasongraham</dc:creator>
      <dc:date>2014-03-12T20:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: 10.2 Arcpy comboboxclass addin simple question</title>
      <link>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650862#M50646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Then you probably changed it manually. Check in the addin assistant what the ID is for your combo box class. All you need are in the help docs.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/combo_box/014p00000028000000/"&gt;http://resources.arcgis.com/en/help/main/10.2/index.html#/combo_box/014p00000028000000/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2014 20:19:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650862#M50646</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2014-03-12T20:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: 10.2 Arcpy comboboxclass addin simple question</title>
      <link>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650863#M50647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Then you probably changed it manually. Check in the addin assistant what the ID is for your combo box class. All you need are in the help docs.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/combo_box/014p00000028000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.2/index.html#/combo_box/014p00000028000000/&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; - &amp;lt;Toolbar caption="MTR Select" category="Township Select" id="MTR_addin.toolbar" showInitially="true"&amp;gt;
- &amp;lt;Items&amp;gt;
&amp;nbsp; &amp;lt;Button refID="MTR_addin.button" /&amp;gt; 
&amp;nbsp; &amp;lt;ComboBox refID="MTR_addin.combobox" /&amp;gt; 
&amp;nbsp; &amp;lt;ComboBox refID="MTR_addin.combobox_1" /&amp;gt; 
&amp;nbsp; &amp;lt;ComboBox refID="MTR_addin.combobox_2" /&amp;gt; 
&amp;nbsp; &amp;lt;ComboBox refID="MTR_addin.combobox_3" /&amp;gt; 
&amp;nbsp; &amp;lt;ComboBox refID="MTR_addin.combobox_4" /&amp;gt; 
&amp;nbsp; &amp;lt;/Items&amp;gt;
&amp;nbsp; &amp;lt;/Toolbar&amp;gt;
&amp;nbsp; &amp;lt;/Toolbars&amp;gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I did not change it, it is combobox, but if I try 'print combobox' I get the error ' combobox not defined&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:35:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650863#M50647</guid>
      <dc:creator>jasongraham</dc:creator>
      <dc:date>2021-12-12T03:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: 10.2 Arcpy comboboxclass addin simple question</title>
      <link>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650864#M50648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;print combobox? Are you trying to run this in an IDE? That won't work for addins. You'll only be able to reference the class values via the ID when it is installed as an addin. What is your end goal for this addin?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2014 20:39:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650864#M50648</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2014-03-12T20:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: 10.2 Arcpy comboboxclass addin simple question</title>
      <link>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650865#M50649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;And remember when you access your combobox you need to first have assign it properties through the class level self variables. You might be missing this part in your combobox class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; def onSelChange(self, selection): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.sel = selection&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;Then get the selection in your other classes like this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;combobox.sel&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2014 20:50:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650865#M50649</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2014-03-12T20:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: 10.2 Arcpy comboboxclass addin simple question</title>
      <link>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650866#M50650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;print combobox? Are you trying to run this in an IDE? That won't work for addins. You'll only be able to reference the class values via the ID when it is installed as an addin. What is your end goal for this addin?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ok, here is the whole code.&amp;nbsp; The original code works as a script but I decided to try making an addin tool.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am not a great coder, trying to learn.&amp;nbsp; This tool references a township and range layer, with the comboboxs the user can select meridain, township, north/south, range, east/west.&amp;nbsp; much of the code works to populate the pull down from the attributes with unique values but doesnt seem to sort.&amp;nbsp; I am able to pass the values for my Twp and Rng but not the M, NS, EW that have a list of values, I could populate like the other two but it seems to bog down,&amp;nbsp; suggestions?( no longer a simple question i guess)&amp;nbsp; alot of stuff on the bottom blocked out that I am working on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# ---------------------------------------------------------------------------
# Township Selector
# Created on: 2014-02-24 15:28:23.00000
# Create by Jason Graham
# Usage: &amp;lt;NS&amp;gt; &amp;lt;EW&amp;gt; &amp;lt;Rng&amp;gt; &amp;lt;Twp&amp;gt; &amp;lt;M&amp;gt; &amp;lt;MTR&amp;gt; &amp;lt;MTRsel&amp;gt;
# Description:Add-in tool to easily select a township then zoom to the selection 
# ---------------------------------------------------------------------------
import arcpy
import pythonaddins
from arcpy import env

 


env.workspace = r"X:\JasonGraham\Landstatus\Data\ls2014.gdb\BaseData"

mxd = arcpy.mapping.MapDocument("CURRENT")

class ComboBoxClass4(object):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for MTR_addin.combobox (ComboBox)"""
&amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.value = "S"&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.items = ("C", "F", "K", "S", "U") 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.editable = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.dropdownWidth = 'WWW'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.width = 'WWW'
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onSelChange(self, selection):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onEditChange(self, text):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onFocus(self, focused):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onEnter(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; def refresh(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass


Twp = []
for row in arcpy.SearchCursor("X:\JasonGraham\Landstatus\Data\ls2014.gdb\BaseData\Townships"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; Twp.append(row.TWP_NUMC)

class ComboBoxClass5(object):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for MTR_addin.combobox_1 (ComboBox)"""
&amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.value = "010"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.items = sorted(Twp)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.editable = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.dropdownWidth = 'WWWW'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.width = 'WWWW'
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onSelChange(self, selection):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; global valName
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; val = (self.items, selection)[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; valName = str(val)
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onEditChange(self, text):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onFocus(self, focused):#show only unique values
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if focused:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; values = sorted(Twp)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uniqueValues = set(values)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.items = []
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for uniqueValue in uniqueValues:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.items.append(uniqueValue)
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onEnter(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; def refresh(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass


class ComboBoxClass6(object):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for MTR_addin.combobox_2 (ComboBox)"""
&amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.value = "N"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.items = ("N", "S")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.editable = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.dropdownWidth = 'WWW'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.width = 'WWW'
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onSelChange(self, selection):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onEditChange(self, text):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onFocus(self, focused):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onEnter(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; def refresh(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
 

Rng = []
for row in arcpy.SearchCursor("X:\JasonGraham\Landstatus\Data\ls2014.gdb\BaseData\Townships"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; Rng.append(row.RNG_NUMC)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
class ComboBoxClass7(object):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for MTR_addin.combobox_3 (ComboBox)"""
&amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.value = "010"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.items = sorted(Rng)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.editable = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.dropdownWidth = 'WWWW'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.width = 'WWWW'
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onSelChange(self, selection):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; global valName
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; val = (self.items, selection)[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; valName = str(val)
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onEditChange(self, text):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onFocus(self, focused):#show only unique values
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if focused:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; values = sorted(Rng)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uniqueValues = set(values)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.items = []
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for uniqueValue in uniqueValues:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.items.append(uniqueValue)
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onEnter(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; def refresh(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
class ComboBoxClass8(object):# Collect East/west&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.value = "E"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.items = ("E", "W")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.editable = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.dropdownWidth = 'WWW'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.width = 'WWW'
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onSelChange(self, selection):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; selection&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onEditChange(self, text):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onFocus(self, focused):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onEnter(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; def refresh(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.refresh()
&amp;nbsp;&amp;nbsp;&amp;nbsp; 

#concatenate inputs
#MTRsel = combobox + Twp + combobox_2() + Rng(selected) + combobox_4()
#print ComboBoxClass8(self)


class ButtonClass3(object):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for MTR_addin.button (Button)"""
&amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.checked = False
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onClick(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #arcpy.SelectLayerByAttribute_management("Townships","NEW_SELECTION",'"MTR" =' + "'%s'" %MTRsel)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #arcpy.mapping.ListDataFrames(mxd)[0].zoomToSelectedFeatures()&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return None
# Select user input value
#arcpy.SelectLayerByAttribute_management("Townships","NEW_SELECTION",'"MTR" =' + "'%s'" %MTRsel) #gets error "ExecuteError: ERROR 000358: Invalid expression
#arcpy.SelectLayerByAttribute_management("Townships","NEW_SELECTION",'"MTR" =' +&amp;nbsp; MTRsel) gets error "TypeError: cannot concatenate 'str' and 'list' objects"
#arcpy.SelectLayerByAttribute_management("Townships","NEW_SELECTION",MTRsel) gets error RuntimeError: Object: Error in executing tool

#Zoom to selection
#arcpy.mapping.ListDataFrames(mxd)[0].zoomToSelectedFeatures()&amp;nbsp;&amp;nbsp; &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:35:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650866#M50650</guid>
      <dc:creator>jasongraham</dc:creator>
      <dc:date>2021-12-12T03:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: 10.2 Arcpy comboboxclass addin simple question</title>
      <link>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650867#M50651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes that adds a significant layer of complexity. What I would recommend is getting one combobox to work as you want, ignoring the rest. Once you know exactly how a combobox works you can create the rest fairly easily. I would recommend adding an onClick function to a button that just calls an arcpy.AddMessage() with the value of your combobox for testing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;An alternative is to add your working toolbox to your addin. See this post for details.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/89502-Python-add-ins-vs.-.NET-add-ins?p=319191&amp;amp;viewfull=1#post319191"&gt;http://forums.arcgis.com/threads/89502-Python-add-ins-vs.-.NET-add-ins?p=319191&amp;amp;viewfull=1#post319191&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2014 21:32:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650867#M50651</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2014-03-12T21:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: 10.2 Arcpy comboboxclass addin simple question</title>
      <link>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650868#M50652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Comboxes 5 and 7 create global variables from your combobox selections. But they have the same name. I think this is a potential problem. Your other comboboxes do not have defined global variables related to combobox selection so this seems like a problem as well. Using the toolbar with Arc Python window open is good for testing toolbars when they are not working properly often times you we get error messages that will help you eliminate problems with your toolbar code. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are trying to use the comboboxes to allow the user to select Lat, Long, Twn and Rng, then create a global variable with a different name from each combobox selection and call these later when you concatenate them together.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Mar 2014 13:00:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650868#M50652</guid>
      <dc:creator>FredKellner1</dc:creator>
      <dc:date>2014-03-13T13:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: 10.2 Arcpy comboboxclass addin simple question</title>
      <link>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650869#M50653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;And remember when you access your combobox you need to first have assign it properties through the class level self variables. You might be missing this part in your combobox class.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; def onSelChange(self, selection):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.sel = selection
&lt;/PRE&gt;&lt;BR /&gt;Then get the selection in your other classes like this.&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;combobox.sel&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Awesome, I got it to work!&amp;nbsp; The whole code works great now, thanks for the help.&amp;nbsp; How about a bonus round?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is just a portion of the code, with this I populate the combobox with only unique values from the attributes, I want it sorted but something isn't working there, any ideas?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Twp = []
for row in arcpy.SearchCursor("X:\JasonGraham\Landstatus\Data\ls2014.gdb\BaseData\Townships"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; Twp.append(row.TWP_NUMC)

class ComboBoxClass5(object): #Collect Township from list of unique values gathered from the layer
&amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for MTR_addin.combobox_1 (ComboBox)"""
&amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.value = "000"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.items = sorted(Twp)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.editable = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.dropdownWidth = 'WWWW'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.width = 'WWWW'
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onSelChange(self, selection):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.sel = selection&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #global valName
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #val = (self.items, selection)[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #valName = str(val)
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onEditChange(self, text):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onFocus(self, focused):#show only unique values
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if focused:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; values = sorted(Twp)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uniqueValues = set(values)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.items = []
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for uniqueValue in uniqueValues:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.items.append(uniqueValue)
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onEnter(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; def refresh(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:35:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/10-2-arcpy-comboboxclass-addin-simple-question/m-p/650869#M50653</guid>
      <dc:creator>jasongraham</dc:creator>
      <dc:date>2021-12-12T03:35:59Z</dc:date>
    </item>
  </channel>
</rss>

