30 Jul 2016 30 Jul '16
steven meier email@example.com writes:
if __name__ == '__main__': import qt5reactor qt5reactor.install() from twisted.internet import reactor reactor.callWhenRunning(print_it, reactor) reactor.run()
For "client-style" things (I guess I just mean "something that exits"), there's even a utility function that calls some method you provide with the reactor as the first argument, and arranges for reactor.stop() to get called exactly once (when the Deferred returned by your method fires).
import qt5reactor qt5reactor.install() from twisted.internet.task import react
if __name__ == '__main__': react(print_it)