[Twisted-Python] Re: GUI responsiveness

Jasper jasper at peak.org
Thu Sep 15 11:46:39 MDT 2005


Nicola Larosa wrote:

>>I integrated my pygame+pyui loop with twisted's default reactor
>>using 5 simple lines of code, so I'm not seeing much room for
>>gain there...
>>    
>>
>
>I'd sure like to see those five lines. ;-)
>
>  
>
Here's what it roughly is, stripping out code and params not directly 
involved.  I just took the simplest thing I could think of, and since it 
worked I didn't look much further.  Perhaps this would have trouble if 
had frequent network traffic, but I don't.

-Jasper


class PyuiClient( NetworkClient ):
    def __init__( self  ):
        # ...
        self._pyuiRefresh( .001 )

    def _pyuiRefresh( self, delay ):
        pyui.draw()
        pyui.update()
        reactor.callLater( delay, self._pyuiRefresh, delay )





More information about the Twisted-Python mailing list