Python code w/ GUI trouble with MapDocument setting.

Discussion created by patrick.jurgens on Aug 17, 2011
Latest reply on Aug 19, 2011 by patrick.jurgens
I have a python code that I wrote to make updates to a file GDB in an .MXD.

The python code includes a GUI that I programed using Tkinter.

The code (hence forth referred to as the GUI) is designed to conflate attributes from a set of large polygon entities (A) down to a separate set of small polygon entities (B). A list on the left side of the GUI shows which B-entities are still missing attributes. The user double-clicks the B-entity to select it, zoom to it, and populate a list of neighboring A-entities. The user may then select the desired A-entity to have its attributes calculated into the selected B-entity.

When I use the GUI as a stand alone program outside of Arcmap I am forced to reference the specific path of the mxd: mxd = arcpy.mapping.MapDocument('C:/folder/project.mxd')
This allows the GUI to access the correct mxd, however changes made to the MXD are not updated in the ArcMap window (I have project.mxd opened in ArcMap). The goal is to have the GUI update the ArcMap window as it goes so that the user has a visual confirmation of what he is doing.

Alternatively I can run the GUI as a geo-processing script (in the foreground) through a customized button on the standard toolbar.
This has the advantage of allowing me to use the "CURRENT" MapDocument. When I use this method the Map is updated whenever actions are made in the GUI.
The problem with this is that when GUI is run as a geo-processing script is does not allow the user to interact with the Map document (cannot use the pan, zoom, select, or other buttons on the standard toolbar). The user is stuck using only the limited capabilities built into the GUI. Also, when i terminate the GUI it takes ArcMap down with it.

Is there some way that I can execute the GUI outside of ArcMap and still have it update changes to the ArcMap screen?


Is there some way that I can execute the GUI from withing the ArcMap environment without having it block all other essential function in the Map Window?