Reputation: 978
I have a signal handler which does its job, but the only ugly thing is whenever Ctrl+C is pressed, a "^C" shows up in the terminal. How do I get rid of that? Or is that a shell behavior?
Upvotes: 1
Views: 195
Reputation: 601669
If you are on a Unix platform, the easiest way to control the terminal is the curses
module. You can turn the echoing of typed characters off with curses.noecho()
, turn it on again with curses.echo()
, or wrap a function call in curses.wrapper()
to turn echoing off during the function call. The latter is the preferred approach -- it will automatically restore the terminal state if an exception occurs.
Upvotes: 1