I am trying to make an add-in tool for ArcMap that will allow a user to draw a rectangle to export the visible layers in their MXD to shapefiles. I used the Python Add-in Wizard to create my add-in, and I modified the python script that executes the business logic of my tool like this:
<SPAN class="keyword token">import</SPAN> arcpy
<SPAN class="keyword token">import</SPAN> pythonaddins
<SPAN class="keyword token">class</SPAN> <SPAN class="token class-name">ToolClass2</SPAN><SPAN class="punctuation token">(</SPAN>object<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="string token">"""Implementation for AddinTest20200513_addin.tool (Tool)"""</SPAN>
<SPAN class="keyword token">def</SPAN> <SPAN class="token function">__init__</SPAN><SPAN class="punctuation token">(</SPAN>self<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
self<SPAN class="punctuation token">.</SPAN>enabled <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">True</SPAN>
self<SPAN class="punctuation token">.</SPAN>cursor <SPAN class="operator token">=</SPAN> <SPAN class="number token">3</SPAN>
self<SPAN class="punctuation token">.</SPAN>shape <SPAN class="operator token">=</SPAN> <SPAN class="string token">"Rectangle"</SPAN>
<SPAN class="keyword token">def</SPAN> <SPAN class="token function">onRectangle</SPAN><SPAN