I often see people looking for a way to extend ArcGIS software: some need an extra tool that is missing in the core product, for others it is about integration with an existing system or application. A good part of users want to have custom dialogs and UI elements embedded as a part of geoprocessing tool dialog window. In this post, I have tried to summarize the options you have for customizing ArcGIS including developing new features on top of the core product.
ArcGIS-based solutions (script tools + Python add-ins)
If you develop a geoprocessing tool and have a Python script, you can make a custom script tool which will have the GUI any other core geoprocessing tool has. There are panels and boxes with Browse buttons, you can work with drop-down lists, check boxes, multi-value tables and many others. Read through all the parameter types you have (you can let users click on the map, draw features and use those features in the analysis and many other advanced features). I am sure quite few of you have not known of this rich functionality.
You can embed your script as a script tool in a custom geoprocessing toolbox and as a Python toolbox. There are two great posts to review: Comparing custom and Python toolboxes and Why learn/use Python Toolboxes over Python Script Tools? to learn more when to use which. If you are just starting with the ArcGIS, consider testing script tools first before playing with Python toolboxes. Setting up a script tool without using a Python toolbox might be much easier for a beginner.
As a last resort, if you want your end users will be able to have a custom dialog box when they will run your tools plus some additional parameter handling, consider embedding your Python script tool into a custom C++/.NET tool which might provide some additional GUI features, but you will be limited to the GP tools GUI scope anyway. I am urged that it is not a good idea to invest into developing with ArcObjects since this technology has a very steep learning curve and will eventually become obsolete as ArcGIS Pro and its .NET SDK will gain popularity. Moving ArcObjects code into ArcGIS Pro is not supported and therefore in my opinion it is better to stay with Python unless you really have to develop something special on top of ArcGIS right now.
Keep in mind that you have Python add-ins which provide additional functionality with the windows, messages and dialogs. They are easy to build and distribute and if you are familar with Python and arcpy, you can start developing them in no time at all.
Desktop app / embed external GUI into a toolbox tool
If you want to develop a stand-alone application (such as .exe file for Windows), you would need to convert your Python script into a an .exe file with any utility such as py2exe. In order for this script to run, you would need to have ArcGIS installed on the machine because it will need to use arcpy site-package which is installed when installing ArcGIS.
As for the custom GUI, you have various Python libraries such as Tkinter (which is shipped with the core Python installation), PyQt/PySide (free Qt bindings), wxPython (wxWidgets of C++ library), and Kivy (a great cross-platform library with rich UI). I have tried them all and liked PyQt most. Here is a couple of GIS.SE resources to learn from:
- Compiling Python Scripts that use ArcGIS Geoprocessing Tools?
- How to develop GUI in Python for geoprocessing?
Because of the ArcMap architecture, you might have troubles running custom GUI in the same process as ArcMap. I’ve seen some examples with Tkinter, but in general there are many issues to tackle with.
From what I’ve experienced I can say that it is probably better either to stay with the core GUI interface which provides in most of the time everything you’d ever need or develop a custom application importing arcpy (with some extra tuning in configuration) and working with the custom GUI (such as developed with PyQt) without starting any ArcGIS application at all. There is an ArcGIS Idea Form Builder for Python Tools, but it is hard to say if this going to be implemented any soon, so you better search for other alternatives.
I’ve done some tests embedding a custom Python script into a toolbox in ArcGIS Pro 1.0 invoking the PyQt 4 script and there were no problems setting up this and running. If using ArcGIS Pro is an option for you, you might consider this – it will be much easier to embed custom Python tools with own GUI into Pro than ArcMap. One of the gotchas is that Pro uses Python 3.4 and it is 64-bit Python which has certain implications for compatibility with PyQt or any other platform of your choice.