python/pyGtk : How to generate a keyboard interrupt?

Peter Hansen peter at engcorp.com
Mon May 3 13:36:01 EDT 2004


Riccardo Attilio Galli wrote:

> On Sat, 01 May 2004 08:31:07 -0700, ahk wrote:
> 
>>I would like to emulate the keyboard interrupt through other means
>>other than the actual hitting on the keyboard such that a call to
>>scaninput() (a C function call?) will be able to pick up the
>>interrupt.  How is it possible to do that in python/pyGTK? TIA.
> 
>>>>raise KeyboardInterrupt 
> 
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> KeyboardInterrupt

I think I detect two people on very different wavelengths
here.  Forgive me if I'm wrong.

I think the OP is talking about the "keyboard interrupt"
in the sense of the low-level mechanisms by which keystrokes
get into the PC.  Each key hit on the keyboard causes data
to be sent on the serial link between the keyboard and the
motherboard.  The motherboard has circuitry which decodes
the keystroke and generates a hardware interrupt through the
PIC (Programmable Interrupt Controller) chip or the modern
equivalent.

People with a hardware or low-level software background will
sometimes talk about "keyboard interrupts" when they really
just mean to ask about receiving raw keystrokes in their
software.

And this has very little to do with Python's KeyboardInterrupt
exception, which is generated by the interpreter when it
detects the Ctrl-C keystroke in a console application.

I hope that helps avoid what I think was some confusion here...

Unfortunately, I can't help the OP with anything to do with PyGTK...
-Peter



More information about the Python-list mailing list