After my script execution ends all of the curses output disappear, is there any way to keep the curses output in the console?
            Asked
            
        
        
            Active
            
        
            Viewed 185 times
        
    1
            
            
        - 
                    I _think_ the solution to this is to make curses use a different ... screen? Sorry, I don't remember the correct terminology here. Basically it switches to its own screen (or canvas? or drawing area?) and switches back when the program ends, but you can disable this behavior. – tripleee Oct 21 '20 at 09:22
 - 
                    You could try not calling **endwin()** when your script execution ends, but your console might result a little bit messed up. – guimauve Oct 21 '20 at 09:24
 - 
                    I guess [window](https://tldp.org/HOWTO/NCURSES-Programming-HOWTO/awordwindows.html) is the term I was looking for. – tripleee Oct 21 '20 at 09:26
 - 
                    @guimauve I already use `curses.endwin()` at the end of the script, but it doesn't help – MrLalatg Oct 21 '20 at 09:32
 - 
                    That's why I said **not** calling it ;) – guimauve Oct 21 '20 at 09:34
 - 
                    @guimauve ah, sry. But the thing is it will screw up the terminal after the script execution so it's not a great solution :( – MrLalatg Oct 21 '20 at 09:37
 - 
                    Have you tried this ? https://stackoverflow.com/questions/14446311/make-curses-program-output-persist-in-terminal-scrollback-history-after-program – guimauve Oct 21 '20 at 10:02
 - 
                    @guimauve Thank you! I will try it – MrLalatg Oct 21 '20 at 10:45
 
1 Answers
1
            
            
        curses switches to the terminal's alternate screen because the terminal description tells it to do that. If you choose (or modify) a terminal description to omit that feature, on exit from curses, the terminal will show what was on the curses screen (usually shifted up by a line).
Further reading:
        Thomas Dickey
        
- 51,086
 - 7
 - 70
 - 105