Search code examples
python-2.7ncursescursespython-curses

how to write the curses window content to the file in python?


I have created window in the curses and created my call flow (data). window = curses.newwin(2500, 2500, 0, 0) How should i copy the window content(exact replica) to the file ?


Solution

  • curses (the underlying library) has scr_dump for this purpose. But the python binding lacks that feature.

    In python, you'd have to make a function that used inch to retrieve characters from the screen and wrote them to a file.

    The description of inch in the python reference makes it clear that it does not work for wide characters (e.g., UTF-8), but it's possible to do something...