I'm trying to add code to exit my curses python script correctly when the user types q
. I can't merely do CTRL+C
because then curses won't be de-initialized correctly.
I haven't found a good solution with getting user input that has a timeout so the program doesn't sit there until the user gives some input.
Is there a simple way with creating a second thread that just handles user input and can request the main thread to run a de-init function?