Hi All, We have developed a GUI with the help of PYQT. Now we have to add this GUI with ArcMap as a extension. Meanwhile some of the tools in the GUI (i.e Combobox - to display list of layers) needs to interact with .Mxd also Can you guys please help on this.THanks and Regards,Sreeni.
Although I would love to be proved wrong, I believe that ESRI has not found a way to get GUI interfaces developed in Python to interact compatibly with ArcMap. They both compete for OS attention and identical resources and generate errors or crashes. So I have not heard of a way to make a python GUI part of an ArcMap extension.
class ToolClass2(object): """Implementation for my_addin.tool (Tool)""" def __init__(self): self.enabled = True self.shape = "Rectangle" def onRectangle(self, rectangle_geometry): mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd)[0] ext = rectangle_geometry thepoly = arcpy.Polygon(arcpy.Array([ext.lowerLeft, ext.lowerRight, ext.upperRight, ext.upperLeft]),df.spatialReference) # '...do stuff #open the .tbx pythonaddins.GPToolDialog('\\\\theUNCpath\ToolShare\geoproc\MyToolbox.tbx', 'TheScriptToRun')
I have similarly used the tools schema configurations to customize standard tool input dialogs (for example populate a combobox based on a selection in another combobox). It, however, suffers performance degradation if you have too many interacting items on a dialog (I had about 15) especially if they perform database queries in response to user inputs (which mine did). The degredation affected opening the tool and making dialog selections. I ended up using VB.Net to rebuild the interface as an Add-In and was much happier with the performance and GUI flexibility.
Completely agree with this. And not just an issue with performance, there are lots of limitations to the Python Add-In. Since my .NET dev environment has been limited, I've had to get creative with the Python Add-In and Geoprocessor object development. It is a pain to get it all integrated and implemented, but comes with the advantage in distribution compared to a COM/ArcObject component that requires installer packages and such.
I see no advantage to Python if an application needs a GUI.
I should clarify that statement. Python has several advantages, with the greatest being a low learning curve and a powerful syntax that greatly reduces the amount of code that has to be written to perform an operation. Also it does not require an application as costly as the full version of Visual Studio to use it (although the free Visual Studio Express version is somewhat usable). That being said, when a GUI is integral to an application, Python is severely limited. .Net will perform much better, but that does assume that the learning curve can be overcome.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.