timer

superpollo user at example.net
Tue Jun 30 15:09:05 CEST 2009


Paul Moore wrote:
> 2009/6/30 superpollo <user at example.net>:
> 
>>Paul Moore wrote:
>>
>>>For a non-toy example, you'd probably create an Event object, use your
>>>timer to set the event, and your while loop would do while
>>>event.is_set(), so the problem wouldn't arise.
>>
>>thank u paul. if u dont mind, would you give me a more detailed piece of
>>code that does what i mean?
> 
> 
> No problem:
> 
> import threading
> 
> e = threading.Event()
> t = threading.Timer(3.0, e.set)
> t.start()
> 
> while not e.is_set():
>     print "Hello, threading world"
> 
> Hope this helps,
> Paul

do not bother answering... my fault.

i wrote e.set() and not e.set

<hides in shame>

thanks again



More information about the Python-list mailing list