I have the following two threads, called from a method:

def uploading_region:
            uploading_region =
AddRegionToServerThread(self,self.SESSION,create_region)
            while uploading_region.UPLOADING:
                pass
            #escape method when uploading_region thread is false

class AddRegionToServerThread(Thread):
    def __init__(self, window, session, dict):
        Thread.__init__(self)
        self.SESSION = session
        self.DICT = dict #contains dbuser,password, etc
        self.STATUS = 'Uploading the region. Please wait...'
        self.WINDOW = window
        self.dlg = wx.ProgressDialog('Please Wait...', self.STATUS,
100, self.WINDOW, wx.PD_AUTO_HIDE | wx.PD_APP_MODAL)
        self.RETICULATE = ReticulateSplines(self.dlg)
        self.UPLOADING = True
        self.start()

    def run(self):
        self.STATUS = 'Adding cities to database. Almost done...'
        #create database
        ....
        self.RETICULATE._Thread__delete()
        time.sleep(3) #give some extra time
        self.UPLOADING = False

class ReticulateSplines(Thread):
    def __init__(self,dialog):
        Thread.__init__(self)
        self.random_messages=[
            'reticulating splines','hiring code monkeys','are you still
watching this?',
            'a penny saved is a penny earned','use this as an
opportunity to go outside',
            'mmm water','drinking decaff coffee','neutering excess
bits',
            'starting improbability drive','delousing edmontonians']
        self.dialog = dialog
        self.x=1
        self.start()

    def run(self):
            self.x += 2

self.dialog.Update(self.x,self.random_messages[random.randrange(len(self.random_messages))])
            time.sleep(3)
            self.__init__(self.dialog)




Now for some reason, I can't delete the thread 'ReticulateSplines' in
the run() function of AddRegionToServerThread(). I call it, but the
dialog window doesn't actually close, while, for some reason I am able
to terminate AddRegionToServerThread.

Any ideas on why? I've tried a combination of things and yet nothing
works.

Any help would be greatly appreciated.

-Thanks
Flamesrock

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to