I am looking to create a button that when clicked, clears feature classes and tables created from another tool. I set up the button and installed it but every time I add it to the map with a toolbar it will come up as "missing" and I don't know why. Does it have something to do with needing to define more in the code? This is the first part of what I have:
import arcpy
import pythonaddins
arcpy.env.workspace = "E:/GIS/File_Organization/Data/Sinks/Sinks.gdb"
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd,"*")[0]
class ClicktoClearAll(object):
"""Implementation for ClearButton2_addin.button (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
if arcpy.Exists("E:/GIS/File_Organization/Data/Sources/Sources.gdb/Selected_Source1"):
arcpy.Delete_management("E:/GIS/INTEK_File_Organization/Data/Sources/Sources.gdb/Selected_Source1")
arcpy.AddMessage("First selection has been removed.")
else:
pass
if arcpy.Exists("E:/GIS/File_Organization/Data/Sources/Sources.gdb/Selected_Source2"):
arcpy.Delete_management("E:/GIS/File_Organization/Data/Sources/Sources.gdb/Selected_Source2")
arcpy.AddMessage("Second selection has been removed.")
else:
pass
if arcpy.Exists("E:/GIS/File_Organization/Data/Sources/Sources.gdb/Selected_Source3"):
arcpy.Delete_management("E:/GIS/File_Organization/Data/Sources/Sources.gdb/Selected_Source3")
arcpy.AddMessage("Third selection has been removed.")
else:
pass