Can a python add-in button activate a tool?

4235
2
02-13-2015 04:46 AM
DavidMartin
Occasional Contributor II

Can anyone tell me how to activate a python add-in tool? When I say "activate", I mean make it the currently active tool for the map.

The reason I'm wanting to do this is so that I can have some code run every time the user clicks on a tool, but then immediately allow them to start drawing on the map. At present, I can only achieve this by having them first click on a button (which will appear to the user to be doing nothing), and then click on the tool so that they can start drawing.

Tags (3)
0 Kudos
2 Replies
FreddieGibson
Occasional Contributor III

Hi David,

Not sure if you still have this question, but the tool from the Python Addin should become the active tool when you click on it. You shouldn't need a button to activate it. Are you still having this problem?

0 Kudos
DavidMartin
Occasional Contributor II

Hi Freddie,

Thanks for your response. The issue was that I wanted some initialisation code to run at the point the tool was activated (prior to map interaction). A button enables code to run when it is clicked. A tool does not. Hence I was trying to activate the tool from the button (after the onclick code had run).

I've since moved to alternative methods, but I'd be interested in any solution, for the future!

0 Kudos