On 07/28/2010 06:01 PM, Jonathan Hartley wrote: > > Oh, plus, while we're on this subject: > > Am I right that curses in Python stdlib doesn't work on Windows, and > there is currently no simple way to fix this? > > Also, is it crazy to imagine that if colorama was pushed through to > completion (ie. to support a majority of the relevant ANSI codes) then > Python's stdlib curses module, unmodified, would suddenly just work on > Windows? (after a call to 'colorama.init()') > > I presume these ideas are oversimplifications or just plain wrong. If > anyone would care to correct my misunderstandings, I'd be very > grateful.
Correct: it's not THAT simple. Python's curses module is a (I'm not sure how thin) wrapper around the good old UNIX curses (ncurses, ...) library. This is written in C, not Python, so it doesn't use Python's sys.stdout object to do I/O. I haven't had a look at colorama, but it sounds like it hooks into sys.stdout, or Python file objects anyway. Far, far above the layer curses does I/O on. So, if you ported a normal curses library to Windows, colorama wouldn't help you a bit. It might be possible to write a curses-compatible library that works with cmd.exe. Maybe. But, even if it's possible, I don't think it's easy, and I especially don't think it would be particularly rewarding. Also, I just stumbled upon http://adamv.com/dev/python/curses/ -- this is probably the only reasonable way to get a useful curses API on Windows: forget the DOS box. -- http://mail.python.org/mailman/listinfo/python-list