[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] pygame networking redux



Richard Jones just mentioned to me off list how he is using twisted.
(He is having issues with the mailing list).

Using twisted like this is not intrusive, as it lets me keep control
of the main loop. Thanks Richard!



   We've just run into this ourselves, but in our case integrating Twisted
   into a pyglet application (though not into its event system yet - just
   into the main loop).

   The docs are extremely sparse in this area, but the following is mostly
   working for us:

     reactor.startRunning(1)       (or 0 if you don't want it to take
over signals)
     while main_loop:
        reactor.iterate(0.01)

   then when you want to exit your program, use:

      reactor.stop(); reactor.iterate(0.01)