AnsweredAssumed Answered

Add-in Combo box error

Question asked by Pi-Hellz on Feb 12, 2015
Latest reply on May 25, 2016 by koric2

Hi,

 

When I try to install the toolbar with the Combo box, I have this error :

 

File "<string>", line 1

SyntaxError: can't assign to operator

 

Usually i'm able to resolve the syntax error but I have no clue for this one.

 

Here my code :

 

import arcpy
import pythonaddins

class LayersComboBoxClass(object):
    """Implementation for Python_Add-In_addin.combo_box (ComboBox)"""
    def __init__(self):
        self.items = []
        self.editable = False
        self.enabled = True
        self.dropdownWidth = 'WWWWWW'
        self.width = 'WWWWWWWWWWWWWWWWWWWW'
    def onSelChange(self, selection):
        layer = r"S:\Geomatique\Pierre-Luc\SPVM\Corridors_Scolaire\Carto.gdb\Ecoles"
        arcpy.SelectLayerByAttribute_management(layer, "NEW_SELECTION", "DESC_LIEU = '" + selection + "'")
        arcpy.RefreshActiveView()       
    def onEditChange(self, text):
        pass
    def onFocus(self, focused):
        self.mxd = arcpy.mapping.MapDocument('current')
        layer = arcpy.mapping.ListLayers(self.mxd, "Ecoles")[0]
        #self.items = []
        values = [row[0] for row in arcpy.da.SearchCursor(layer, ["DESC_LIEU"])]
        for uniqueVal in sorted(set(values)):
            self.items.append(uniqueVal) 
    def onEnter(self):
        pass
    def refresh(self):
        pass

 

Thanks for your help

Outcomes