[Twisted-Python] Twisted and curses

screwtape at froup.com screwtape at froup.com
Tue Aug 19 02:01:56 EDT 2003


On Tue, Aug 19, 2003 at 11:42:07AM +1000, Andrew Bennetts wrote:
> On Mon, Aug 18, 2003 at 01:21:42AM +1000, screwtape at froup.com wrote:
> [...]
> > Twisted does not come with a curses reactor, but with a little
> > experimentation I found out how to make the reactor's .listenWith()
> > method do more or less what I wanted.
> 
> Have you seen doc/examples/cursesclient.py ?

Uh... no. Bugger, I thought I searched the docs before starting.
Evidently, I wasn't thorough enough.

As it turns out, the idea I eventually hit upon is exactly the method
that example uses. Oh well, I guess I learned more about the internals
of the reactor than I otherwise would have. :)

> > Code is here (5KB tarball):
> > 
> > 	http://members.optusnet.com.au/thristian/curses.tar.gz
> > 
> > You get cursesapp.py, a thin wrapper around curses setup, teardown,
> > and the eventloop, and test.py, a very simple demonstration program.
> > There's lots of comments and docstrings.
> > 
> > What do you think?
> 
> I'm no curses expert, but I'd be interested to see if your cursesapp can
> simplify doc/examples/cursesclient.py... ;)

Hmm.. I don't know about simplify, but beautify, sure.

Also, my code handles terminal resizing, which the example code
doesn't.

I'll take a closer look at cursesclient.py tonight or tomorrow and see
if I can (a) figure out exactly what it's doing, and (b) write an
equivalent program that uses my curses module.

> I think proper curses support in Twisted is a good idea though...

Me too, surprisingly. :)

-- 
 ___________ ___________________________________
| Screwtape | http://livejournal.com/~thristian |______ _____ ___ __ _  _   _
|
| This empty tagline? It's where my conversation piece used to be.
|




More information about the Twisted-Python mailing list