Is there a way to create a second terminal so that all calls to curses functions operate on that, rather than in the existing terminal? I work much faster when I can try things out interactively, so I’d like to be able to run an interactive python interpreter in one terminal and see the curses output in another.
As it is, calling initscr() in an interactive window either fails (PyDev) or permanently takes away window refresh from the host (Spyder) or causes weird behavior in the console (IPython).
Is it possible to take over a different terminal using setupterm()? If so, where do I get a different TERM string to call it with?
I don’t believe so as the curses module is mostly (totally?) implemented at the C level. It’s unlikely that it would provide such hooks, although if you are familiar with the language it might be worth looking thru the source.
However while reading your question I thought of another technique which I use in other contexts. You can save a script via another terminal/editor and use a technique similar to the dnotify command (or even simple polling) to load it into your running program.
Another idea would be to use sockets to send commands over and execute them. Of course this is dangerous security-wise so take the necessary precautions.
You’ll have to build some infrastructure, but it would likely be much easier than adding multiple device support to curses.