Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
Can't Delete a Thread
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="flamesrock, post: 1873607"] 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 [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
Can't Delete a Thread
Top