How can I know both the Key c and Ctrl on the keyboard are pressed?
Duncan Booth
duncan.booth at invalid.invalid
Tue Jan 30 09:43:27 EST 2007
"Szabolcs Nagy" <nszabolcs at gmail.com> wrote:
> however Ctrl+C is a special key combination: running python in a
unix
> terminal it raises KeyboardInterrupt exception, imho in a windows
cmd
> promt it raises SystemExit
>
Your humble opinion is wrong.
Under windows Ctrl-C raises KeyboardInterrupt just as it does under
linux. Ctrl-break by default terminates the program (without invoking
Python's usual cleanup), but you can override that behaviour by
registering a different signal handler.
e.g.
import signal
signal.signal(signal.SIGBREAK,
signal.default_int_handler)
will make Ctrl-break raise KeyboardInterrupt just like Ctrl-C.
More information about the Python-list
mailing list