[python-win32] Geting values from a thread

python at kareta.de python at kareta.de
Mon Jan 10 19:41:55 CET 2005


Hi all,

I am wondering about the following situation:

I defined a class and inside this class I start a new thread with
thread.start_new_thread. When I set some attributes of that class inside
the thread_function, the attributes are not changed.

<code>
class test:
   def __init__(self):
       self.param=''
       thread.start_new_thread(self.run_thread,())
   def run_thread(self):
       self.param='hello'
       return

t=test()
print t.param #result is an empty string
</code>
The run_thread function operates on the same object but all changes are lost
when the thread returns. How can I pass values from the thread function to the
main thread ?

regards,
Jürgen



-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/


More information about the Python-win32 mailing list