AnsweredAssumed Answered

Re-Initializing wxPython GUI without crashing ArcMap - 10.1 Python AddIn

Question asked by markieta on Aug 2, 2012
Latest reply on Apr 4, 2013 by nqazi
I am building upon this example of wxPython in ArcGIS 10.1.
http://betablogs.esri.com/beta/arcgis/2012/05/03/custom-wxpython-guis-an-approach-for-arcgis-10-1/

Outside of ArcMap, I can Close() the GUI and re-initialize it in its original state using the following method:

def OnReset(self, event):     self.parent.Close()      frame = myFrame()


Doing this is ArcMap causes it to crash... I think it has to do with the 'extensions' portion of the AddIn.

class WXExtension(object):     """Create a wxPython Extension inside ArcMap"""      def __init__(self):         self._wxApp = None         self._enabled = None      def startup(self):         try:             self._wxApp = wx.App()             self._wxApp.MainLoop()         except Exception:             pythonaddins.MessageBox("Unable to start the Extension.", "Extension Error")      @property     def enabled(self):         if self._enabled == False:             button.enabled = False         else:             button.enabled = True         return self._enabled      @enabled.setter     def enabled(self, value):         self._enabled = value  class Button(object):     """ Create a custom button inside ArcMap"""      _dlg = None      @property     def dlg(self):         if self._dlg is None:             self._dlg = myFrame()         return self._dlg      def __init__(self):         self.enabled = True         self.checked = False      def onClick(self):         try:             self.dlg.Show(True)         except Exception:             pythonaddins.MessageBox("Can't show myFrame.", "Error")             pass


Included the DMP file from the ArcMap crash...

Attachments

Outcomes