Alan, Thanks for the reply. I was hoping there might be a quick fix, and it is really a wx.Frame, that contains the wx.gauge.
Here's the story. I'm using SPSS. I have written this program to create a list of doctors from medical claims data to be used in another module where I have set up check boxes that trigger an analysis to be run for whatever doctor's box is checked. The program is running with the SPSS Python-Integration Package, and is running externally, not in SPSS. I just needed some indicator that the process was running because it can take a long time (15, 20, or 30 minutes, depending on the size of the claims file which can be more than 4gb). Okay, here's the syntax. Please excuse any sloppiness in my form. I'm just learning. I really appreciate the help! ############################ # Module: lice.py # Author: Matthew Pirritano # Date: 2009/12/15 # Version: Draft 0.1 ''' Create a list of providers for drop down to select for further analyses ''' ############################### # Log: # 2009/12/15 MP - File created # ################################ # Ask the user to select the AMM file they would like to use import wx, os, spss, sys, thread class MyFrame(wx.Frame): def __init__(self, parent, title): wx.Frame.__init__(self, parent, -1, title, pos=(350, 150), size=(250, 150)) # Create the menubar menuBar = wx.MenuBar() # and a menu menu = wx.Menu() # Now create the Panel to put the other controls on. panel = wx.Panel(self) # and a few controls text = wx.StaticText(panel, -1, "I'm working on it!!!") text.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD)) text.SetSize(text.GetBestSize()) btn = wx.Button(panel, -1, "Close", (10,30)) self.count = 0 self.g2 = wx.Gauge(panel, -1 , 50, (50, 60), (125, 25)) self.Bind(wx.EVT_END_PROCESS, self.on_end_process) self.Bind(wx.EVT_TIMER, self.TimerHandler) self.timer = wx.Timer(self) self.timer.Start(100) # bind the button events to handlers self.Bind(wx.EVT_BUTTON, self.OnTimeToClose, btn) # Use a sizer to layout the controls, stacked vertically and with # a 10 pixel border around each sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(text, 0, wx.ALL, 10) panel.SetSizer(sizer) panel.Layout() self.chooserThread() def chooserThread(self): thread.start_new_thread(self.chooser,()) def OnTimeToClose(self, evt): """Event handler for the button click.""" print "See ya later!" self.Close() def TimerHandler(self, event): self.count = self.count + 1 if self.count >= 50: self.count = 0 self.g2.Pulse() def on_end_process(self): self.Frame.Destroy() self.kill() app.Destroy() self.g2.Destroy self.__init__(None,-1) def onProvlistDone(self): self.gauge.abort self.Close self.kill def chooser(self): app = wx.PySimpleApp() self.infile = '' fileWildcard = "sav files (*.sav)|*.sav|" \ "All files (*.*)|*.*" dlg = wx.FileDialog(None, message="Choose the file to derive list from...", defaultDir="d:/data/", defaultFile="", wildcard=fileWildcard, style=wx.OPEN| wx.MULTIPLE | wx.CHANGE_DIR ) if dlg.ShowModal() == wx.ID_OK: self.infile = dlg.GetPath() else: self.infile = None dlg.Destroy() self.on_end_process app.Destroy() thread.start_new_thread(self.provlist,()) def getfile(self): return self.infile def provlist(self): spss.Submit(r""" GET FILE= '%s'. save outfile = '%s' /compressed. get file = '%s'. SORT CASES BY license2. AGGREGATE /OUTFILE='D:\Data\AMM\providers\list.sav' /PRESORTED /BREAK=license2 /N_BREAK=N. get file = 'D:\Data\AMM\providers\list.sav'. delete variables N_BREAK. """ % (self.infile, self.infile, self.infile)) i = [0] dataCursor=spss.Cursor(i) oneVar=dataCursor.fetchall() dataCursor.close() uniqueCount=len(set(oneVar)) licenses =[] i = [0] for i in range(uniqueCount): licenses.append(oneVar[i][:1][0]) print licenses self.getfile print self.infile self.on_end_process() if __name__ == "__main__": app = wx.PySimpleApp() app.TopWindow = MyFrame(None, "Please be patient!") app.TopWindow.Show() app.MainLoop() Matthew Pirritano, Ph.D. Research Analyst IV Medical Services Initiative (MSI) Orange County Health Care Agency (714) 568-5648 -----Original Message----- From: tutor-bounces+mpirritano=ochca....@python.org [mailto:tutor-bounces+mpirritano=ochca....@python.org] On Behalf Of Alan Gauld Sent: Thursday, December 31, 2009 2:44 AM To: tutor@python.org Subject: Re: [Tutor] getting a wx.gauge to close! "Pirritano, Matthew" <mpirrit...@ochca.com> wrote > I have got a wx.gauge running and I cannot get it to go away! > Any quick and dirty ideas or do you need my ugly syntax. I'm a newbie! I've no idea what you've done but guages don't normally go away. The window/dialog they are in sometimes goes away, but without knowing how you have constructed your GUI for the guage, what events it is monitoring etc it is impossible to give you any real advice. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor