What's new in 3.0 about threading?
Terry Reedy
tjreedy at udel.edu
Fri Jan 30 16:47:01 EST 2009
郑义 wrote:
> Hello
> I have questions about threading:
>
> import threading
> class myThread(threading.Thread):
> def run(self):
> print('hello,threads')
> if __name__=='__main__':
> threads=myThread()
> threads.start()
>
> Above program does't work at 'Run Module' in IDLE,
What does 'doesn't work' mean? If you get an error traceback, post it.
Possible problem: IDLE runs on top of pythonw.exe (not python.exe) which
does not open a window (IDLE runs its own window). So I would not be
surprised if output from separate thread in pythonw process gets lost.
If that is the problem, try having the run() method send something back
to the main thread, say through a Queue, and print from there after
starting the subthread.
> but it works well
> under executing scripts.Is it anything wrong?
> WindowXP,Python 3.0
> Thanks.
>
>
> ------------------------------------------------------------------------
>
> --
> http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list