close wxPython main frame within python addins

Discussion created by ibraheem99 on May 10, 2013
I have created a dialog box class (frame with couple of comboboxes -- shown only one below as an example) and calling it from a different class. The problem lies in closing the frame once i retrieve values from comboboxes. I have tried using "self.Show(False)" or "self.Destroy()" but it is in some sort of continuing loop. Please suggest how to kill this event. Thanks!

import arcpy
import pythonaddins
import wx

class ExtentData(object):
"""Implementation for ExtentData_addin.tool (Tool)"""
    def __init__(self):
        self.enabled = True
        self.checked = False
        self.cursor = 5
        self.shape = 'Rectangle'

    def onRectangle(self, rectangle_geometry):

    dlg = None
    extent = rectangle_geometry

    if extent != None:
        self.dlg = ComboBoxFrame()

class ComboBoxFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, -1, 'Input Data Selection', size=(350, 300))
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        panel = wx.Panel(self, -1)

        DemList = ['DEM1', 'DEM2', 'DEM3']
        self.Dem = wx.ComboBox(panel, -1, "", (15, 30), wx.DefaultSize,DemList, wx.CB_DROPDOWN)
        self.Bind(wx.EVT_COMBOBOX, self.OnSelect, self.Dem)

        self.btnApply = wx.Button(panel, label="Apply", pos=(65, 200))
        self.Bind(wx.EVT_BUTTON, self.OnClose, id=self.btnApply.GetId())

    def OnClose(self, event):
        dem = str(self.Dem.GetValue())


app = wx.PySimpleApp()