3

I have done some scripting using ArcPy and Python, and I want to make some interface to select some shapefile. What are the best graphic tools for Python to make this?

I don't need high detailed graphics.

  • How do you want to run your scripts? From ArcGIS interface or as an independent desktop application with its own GUI? – Alex Tereshenkov Feb 6 '15 at 9:10
  • I was thinking about an independent desktop application... but the arcGIS interface could be a good option too – Gsanez Feb 6 '15 at 9:16
10

ArcGIS-based solution (script tools + Python add-ins)

Having 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).

You can embed your script as a script tool in a geoprocessing toolbox and as a Python toolbox. Please refer to this help page Comparing custom and Python toolboxes and this GIS.SE Why learn/use Python Toolboxes over Python Script Tools? question 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. Imo they are much easier to start working with.

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.

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 since 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 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 TKinter, PyQt/PySide, wxPython (some of the most used). There is a list of resources to learn from.

Because of the ArcGIS 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 I seriously doubt Esri will develop this, so you better search for other alternatives.

I've done some tests embedding a custom Python script into a toolbox in ArcGIS Pro invoking the PyQt script and there were no problems setting up this and running. If using 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.

  • wow thats a lot of usefull info. I will check before do nothing more. – Gsanez Feb 6 '15 at 11:14
  • +1! If the tool should be run inside ArcGIS then you should definitely go for the ArcGIS-based solution; its very easy to set up, and it requires no real programming (except that you need to do some slight modifications in your code, such as adding GetParameterAsText). – BritishSteel Feb 6 '15 at 11:43
  • 1
    Should you want to execute it outside of ArcGIS, then Tkinter would be much easier to learn than PyQt. You would most likely be able to spend a few hours with a tutorial (if at all) and that would be enough to throw together a simple GUI. Also very convenient as it is part of your Python installation. PyQt will require much more work to get into (and you'd have to install it), but the output would also be much prettier! – BritishSteel Feb 6 '15 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.