windows-curses icon indicating copy to clipboard operation
windows-curses copied to clipboard

CTRL-C doesn't raise KeyboardInterrupt

Open hajimen opened this issue 4 years ago • 0 comments

Hello, I found CTRL-C doesn't raise KeyboardInterrupt in windows-curses.

import time
import curses

def main(stdscr):
    begin_x, begin_y = 20, 7
    width, height = 40, 5
    win = curses.newwin(height, width, begin_y, begin_x)
    win.scrollok(1)
    while True:
        k = win.getch()
        win.addstr(f'key {str(k)} typed.\n')
        win.refresh()
        time.sleep(0.1)

if __name__ == "__main__":
    print(curses.wrapper(main))

The code above shows key 3 typed. for CTRL-C in windows-curses. This is raw mode behaviour. In Linux, CTRL-C raises KeyboardInterrupt.

Both are Python 3.8.1.

hajimen avatar Feb 07 '20 05:02 hajimen