python - wxPython Update Progress Dialog from separate thread -


i'm attempting run progress dialog isn't on timer updates based on status of files uploading server. don't care how progress bar visually represented, want accurate reflection of process tracking. i've try use while , if on thread.isalive() yet won't give me active bar while process running. here source both bar i'm using thread being called.

class progbar(wx.frame):     def __init__(self):         wx.frame.__init__(             self, none, wx.id_any, "please wait."             )         self.centre()         max = 250          dlg = wx.progressdialog(             "please wait.",              "please wait while request processed.",             maximum = max,             parent=self,             style = wx.pd_can_abort             |wx.pd_app_modal             |wx.pd_auto_hide             )          keepgoing = true         count = 0          while keepgoing , count < max:             count += 1             wx.millisleep(50)              if count >= max / 2:                 (keepgoing, skip) = dlg.update(count)             else:                 (keepgoing, skip) = dlg.update(count)          dlg.destroy() 

and thread...

def uploadtoserver(self, event):     if peptalksource none:         dlg = wx.messagedialog(self,         "you must attach pep talk file!",         "missing attachments!", wx.ok|wx.icon_question)         result = dlg.showmodal()         dlg.destroy()     else:         if os.path.isdir(         r"\\server\address\goes\here"         ):             threadone = functhread(copymove, ())             threadone.start()             dlg = progbar()             threadone.join()         else:             dlg = wx.messagedialog(self,             "the server not reached.  please visit menu.",             "server unavailable", wx.ok|wx.cancel|wx.icon_question)             result = dlg.showmodal()             dlg.destroy() 

i've tried ditch class , insert dialog straight function no luck. appreciated.

i wrote sort of thing on blog earlier month:

what think need wx.gauge widget. can use python determine size of files uploading , use information set gauge's range. you'll want upload in thread, in chunks. you'll read file in chunks too, 1024k , write server in same chunks. after each write, update progress bar.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -