Is there anyway to get 2 python threads to talk to one another?<br><br>I have a GUI which is spawning a thread to make a large calculation (that way the GUI does not appear to be non responsive). I am trying to attach a progress bar to the threaded action. As the thread is calculating data, I would like it to communicate with the other (progress) thread to update it.
<br><br>On windows, when I spawn the progress bar without using threads, the progress bar stalls.... <<this does not happen on linux.>> So I thought by spawning the progress bar by using a thread, it would not stall....... If anyone can think of another technique.... I am all ears.
<br><br>~~~~~~~~~~START SAMPLE~~~~~~~~~~~~~~~~~~~~~~~~<br>def progressBar(status):
<br> mroot = Tkinter.Tk(className='Worker Bee')
<br> metric = Meter(mroot, relief='ridge', bd=3)
<br> metric.pack(fill='x')
<br> metric.set(status, 'Starting ...') <br><br>def fetchFiles(file1,file2,file3):
<br> method = ''
<br> print file1
<br> print file2
<br> print file3
<br> f1 = fopen(file1)
<br> a = f1.readlines(); f1.close()
<br> d1 = {}
<br> for c in a:
<br> for m in mailsrch.findall(c):
<br> d1[m.lower()] = None
<br><br> ####I Would like to Update the progress bar running in the other thread here. <br> ## set status = .33 and update progress bar.<br> if file2 == '':
<br> domain(d1,file3)
<br>#... <br><br>def startProc():<br> status = 0<br> thread.start_new_thread(fetchFiles, (f1name,f2name,f3name,))<br> thread.start_new_thread(progressBar, (status,))<br><br>~~~~~~~~~~END SAMPLE~~~~~~~~~~~~~~~~~~~~~~~~
<br>