python/pyGtk : How to generate a keyboard interrupt?

A

ahk

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.
 
P

Peter Hansen

Riccardo said:
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
 
R

Riccardo Attilio Galli

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.
Traceback (most recent call last):
File "<stdin>", line 1, in ?
KeyboardInterrupt

--
-=Riccardo Galli=-

_,e.
s~ ``
~@. ideralis Programs
.. ol
`**~ http://www.sideralis.net
 
R

Riccardo Attilio Galli

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.

shame on me.
I'd have a low background, but I forget to use it :)
I completely misunderstood the OP.

ops

Riccardo
 
A

ahk

Yup..
Sorry that I didnt phrase my query more clearly. Is it possible to
generate all those raw keystrokes w/o actually typing on the keyboard?
Perhaps write to some keyboard buffer or something??? TIA
 
P

Peter Hansen

ahk said:
Yup..
Sorry that I didnt phrase my query more clearly. Is it possible to
generate all those raw keystrokes w/o actually typing on the keyboard?
Perhaps write to some keyboard buffer or something??? TIA

In many GUI frameworks there is some way to "post" or "pump"
generated events into the event handling system. Then one can
create event objects which are the same as the events used to
represent keystrokes, and the framework and application may
not be able to tell the difference.

Not sure if PyGTK can do this or, if so, how.

-Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top