Monday, April 19, 2010

A simple pyevent example.

Because I couldn't find one myself.

import event

event.init()
event.read(socket.fileno(), call_me_when_readable)
event.write(socket.fileno(), call_me_when_writable)
event.timeout(30, call_me_soon) #after 30 seconds!
event.loop(True) #loop once, return 0 if events are waiting.
event.loop(False) #loop until no more events are waiting.

1 comment:

lorg said...

Looks sweet!
I wasn't aware of pyevent, and now I'll check it out.
Thanks!

Popular Posts