Well if this cannot be done, can a thread call a function in the main method?<br>I have been trying and have not been successive. Perhaps I am using thread incorrectly. <br><br><div><span class="gmail_quote">On 2/18/07, <b class="gmail_sendername">
Sick Monkey</b> <<a href="mailto:sickcodemonkey@gmail.com">sickcodemonkey@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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>
</blockquote></div><br>