Fast text display?

Christopher Subich spam.csubich+block at block.subich.spam.com
Wed Jun 8 14:15:35 EDT 2005


As a hobby project, I'm writing a MUD client -- this scratches an itch, 
and is also a good excuse to become familiar with the Python language. 
I have a conceptual handle on most of the implementation, but the 
biggest unknown for me is the seemingly trivial matter of text display.

My first requirement is raw speed; none of what I'm doing is 
processing-intensive, so Python itself shouldn't be a problem here.  But 
still, it's highly desirable to have very fast text updates (text 
inserted only at the end)-- any slower than 20ms/line stretches 
usability for fast-scrolling.  EVERY other action on the text display, 
though, like scrolling backwards or text selection, can be orders of 
magnitude slower.

The second requirement is that it support text coloration.  The exact 
markup method isn't important, just so long as individual characters can 
be independently colored.

The third requirement is cross-platform-osity; if you won't hold it 
against me I'll tell you that I'm developing under Cygwin in Win2k, but 
I'd really like it if the app could run under 'nix and mac-osx also.

I'm pretty open to any graphical toolkit -- I have experience with none 
of them, so I have little in the way of prejudice.

I'm not even sure where to start looking to see if a widget that does 
this has been premade -- the text widgets that I've seen so far have all 
had documentation geared more towards text editing than pure display. 
My closest look has been at PyGTK -- the GTK text widget is certainly 
complex enough to handle the markup, but it also seems a little bit 
feature-rich for my needs so I'm concerned about the overhead.

In a worst-case scenario, I could try writing a widget-lite with SDL or 
possibly an OpenGL texture, but if a widget somewhere will already do 
this then it'd be needless work.  To boot, I have no idea how to handle 
selection on such a homebrew-display if I'm using a proportional font, 
but that's a minor matter.

So, the one-line summation of the novel above, does any one know of a 
gui toolkit/widget that will do (preferably extremely) fast text display 
in a cross-platform manner?

PS: I couldn't get a prototype curses display working either, the 
scroll() function didn't work -- interactive log below:
 >>> import curses
 >>> x = curses.initscr()
 >>> print curses.has_il()
True
 >>> x.idlok(1)
 >>> x.scroll(1)
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   _curses.error: scroll() returned ERR



More information about the Python-list mailing list