One hassle, I am unable to close main frame. This script is part of ArcGIS 10.1 which isn’t responding to “self.Show(False)”. This combobox is called from a tool (combobox is visible once tool finished its job) and after pressing “Apply” button, this frame is still visible which means that it initiated another similar event. Can anyone please suggest how to close frame once i click ‘Apply’ button. Apparently “self.Destroy()” isn’t working as well.
···
On Thursday, April 25, 2013 9:52:36 AM UTC-4, Ibraheem Khan wrote:
Hi,
I am using two combobox on a single frame and running into a problem. Whenever i select an option from combobox1 then the associated processes are executed instead of waiting for me to finish selecting option from combobox2 and press ‘apply’ button. Please suggest where things are going out of control. Thanks!
Following is code snippet:
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)
wx.StaticText(panel, -1, “Select Soil Data”, (15, 15))
SoilList = [soil1’, ‘soil2’, ‘soil3’]
self.Soil = wx.ComboBox(panel, -1, “”, (15, 30), wx.DefaultSize,SoilList, wx.CB_DROPDOWN)
self.Soil.Bind(wx.EVT_COMBOBOX, self.OnSelect, self.Soil)
wx.StaticText(panel, -1, “Select Hyd Condition”, (15, 15))
HydList = [‘h1’, ‘h2’, ‘h3’]
self.Hyd = wx.ComboBox(panel, -1, “”, (15, 30), wx.DefaultSize,HydList, wx.CB_DROPDOWN)
self.Hyd.Bind(wx.EVT_COMBOBOX, self.OnSelect, self.Hyd)
self.btnApply = wx.Button(panel, label=“Apply”, pos=(65, 200))
self.Bind(wx.EVT_BUTTON, self.OnClose, id=self.btnApply.GetId())
self.Show(True)
def OnClose(self, event):
self.Show(False)
def OnSelect(self, event):
soil = str(self.Soil.GetValue())
do_something_…