How can I know both the Key c and Ctrl on the keyboard are pressed?
nszabolcs at gmail.com
Tue Jan 30 14:44:40 CET 2007
tidegenerator at tom.com wrote:
> How can I know the Key c and Ctrl on the keyboard are pressed? Or how
> to let the program press the
> key Ctrl+c automatically? I just want to use python to develop a
> script program.
depends on where you got your input from and what do you exactly want
in a gui app you get input events from the gui toolkit (wx, gtk, sdl/
in a console app if you use curses lib then you can use getch() oslt
if you want a general solution to get input key events in a simple
script then you cannot do that.
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
so you can emulate those by using:
hope this helps
More information about the Python-list