On 2021-01-18, Random832 <random...@fastmail.com> wrote: > On Fri, Jan 15, 2021, at 13:36, Alan Gauld via Python-list wrote: >> That could make a big difference, the putp() function specifically >> states that it writes to stdout. > > I think there is a reasonable argument that this is a deficiency of > the curses module. > > I think that the curses module should A) expose a version of tputs > that accepts a python callback to process each output byte B) expose > a version of putp that uses python's stdout[.buffer].write rather > than C's putchar.
Agreed. I tried to use ctypes to call tputs with a Python callback that wrote to sys.stdout, but was unable to get it to work. FWIW, I've written up notes on the problem and provided demos of various solutions: https://github.com/GrantEdwards/Python-curses-and-terminfo -- https://mail.python.org/mailman/listinfo/python-list