Tejovathi P wrote:
> Hi all,
>
> I have a GUI applicaion(along with threads). When the run button is 
> pressed in the GUI a separate thread starts( Thread is created using 
> beginthreadex) and does the
> required activity.
> Now, while the thread is being executed, i want the locals() present 
> inside the thread's run function to be avaialbe in the GUI class from 
> where the thread class is being created

Why do you use execfile for this?  That seems very odd to me.  Also, why 
use beginthreadex instead of the native Thread module?

Adding threading doesn't really change this problem.  Just think about 
how you'd solve it without threading: by creating a class and using import:

test.py:

class Handler():
  def run():
    self.i = 1
    self.j = 2
    self.k = 4
    while(10000):
        print i
        print j
        print k
        self.i = 1+1
        self.j += 2
        self.k += 3

main.py:

    def func(self):
        import temp
        self.thread = temp.Handler()
        self.thread.run()

Now, the rest of the GUI can examine self.thread.i, self.thread.j, and 
self.thread.k.  There are locking issues here, but that's left as an 
exercise for the reader.

That's probably not the perfect solution, but it gives you the general 
direction.

-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to