[Twisted-Python] Two main loops

Bernie Roehl broehl at gmail.com
Sun Nov 11 11:31:07 EST 2007


Great -- that should work.

Thanks everyone for your help!



On Nov 11, 2007 10:44 AM, Jean-Paul Calderone <exarkun at divmod.com> wrote:
> On Sun, 11 Nov 2007 09:51:33 -0500, Bernie Roehl <broehl at gmail.com> wrote:
> >Did you find that passing zero as the first parameter to callLater
> >cause it to be called often enough?  I really want to make sure the
> >rendering is happening as quickly as possible.
> >
>
>     exarkun at boson:~$ cat howfastdoesitspin.py
>
>     from twisted.internet import reactor
>     from twisted.internet.task import LoopingCall
>
>     class Spinner(object):
>         def __init__(self):
>             self.count = 0
>
>         def tick(self):
>             self.count += 1
>
>     spinner = Spinner()
>     call = LoopingCall(spinner.tick)
>     call.start(0)
>     reactor.callLater(1, reactor.stop)
>     reactor.run()
>     print spinner.count
>     exarkun at boson:~$ python howfastdoesitspin.py
>     5448
>     exarkun at boson:~$
>
> Practically speaking, you probably don't need to render more than about
> 3000 frames per second.  ;)
>
> Jean-Paul
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>



-- 
   Bernie Roehl
   Mail: broehl at gmail.com




More information about the Twisted-Python mailing list