Properties of the Tool class:
Allows you to update your cursor when the tool is clicked. By default, the cursor is set to 0. The choices of cursor ID values are shown here:
Returns the availability of the tool, where by default it is set to True. When this property is set to False, the tool is disabled and unavailable. This property allows you to write logic to test the state of the desktop application in order to disable or enable the tool. For example, you might have a tool that requires a data layer to be loaded in ArcMap before execution is possible.
Allows you to specify the type of shape that is drawn on the map. The shape can be used to select features, define an extent, or used as input to geoprocessing tools. After the shape is added to the map, the shape will dissappear from the display and its corresponding function is called. The functions are explained below.
There are three types of shapes that can be defined:
This is a Python built-in function referred to as the constructor where some initial variables can be defined. By default, the cursor and enabled properties of the tool is initially set for you.
Occurs when a mouse button is double-clicked when this tool is active.
Occurs when the mouse button is released after the circle is drawn on the map. circle_geometry represents a polygon object.
Occurs when the mouse button is double-clicked to finish drawing the line on the map. line_geometry represents a Polyline object.
Occurs when the mouse button is released after the rectangle is drawn on the map. rectangle_geometry represents an Extent object.
onMouseDown(self, x, y, button, shift)
Occurs when a mouse button is released when this tool is active.
onMouseDownMap(self, x, y, button, shift)
onMouseUp(self, x, y, button, shift)
onMouseUpMap(self, x, y, button, shift)
onKeyDown(self, keycode, shift)
Occurs when a key on the keyboard is pressed (onKeyDown) or released (onKeyUp) when this tool is active.
onKeyUp(self, keycode, shift)
Causes the tool to no longer be the active tool.
|Key code||Keys that are pressed|
SHIFT + CTRL keys
SHIFT + ALT keys
CTRL + ALT keys
SHIFT + CTRL + ALT keys
|Button code||Mouse buttons that are pressed|
Left and Right buttons
Left and Middle buttons
Right and Middle buttons