Keyboard Events

G

Gandalf

I use WX on windows XP and I try to generate an event when the user is
clicking the keyboard while the application frame is not in focus.
All I manged to do were while the application frame is in focus
Can someone please show me how to do it?

Thanks !
 
M

Mike Driscoll

I use WX on windows XP and I try to generate an event when the user is
clicking the keyboard while the application frame is not in focus.
All I manged to do were while the application frame is in focus
Can someone please show me how to do it?

Thanks !

You can only catch the keyboard events for whichever widget is in
focus. So, if you have a text control, you'll need to bind to that.
The events you're likely need are EVT_KEYDOWN or EVT_CHAR. You cannot
catch keyboard events with wx if you are using MS Word. For that sort
of thing,you'll have to hook in at the OS level.

Mike
 
G

Gandalf

I'm no expert, but I think normal operation is that the operating
system does not send events to an application unless that application
has the focus.

To counter that, though, there is no doubt some way to inform the OS
that an application is interested in all events, even those not meant
for it directly. As such a capability tends to be OS specific, it may
not be easily exposed. Under Windows, this probably requires getting a
handle on the "desktop window" and processing messages that it sees
(without failing to pass them on to whatever other windows are looking
for them)
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/

Thanks!
Anyone know which library should i learn then?
 
G

Gandalf

Looks like you need to dive into Win32 APIhttp://msdn.microsoft.com/en-us/library/ms697544(VS.85).aspxhttp://msdn.microsoft.com/en-us/library/ms645530(VS.85).aspx
and others
combined with ctypes.

Ivan

well, that seems extremely valuable but how can i implement those
functions with python?
 
G

Gandalf

well, that seems extremely valuable but how can i implement those
functions with python?

You know what I'm sorry, I will try to understand the ctypes lib
before bothering you.

thank you all!
 
M

Mike Driscoll

No need to sorry. I have actually found very valuable information athttp://www.brunningonline.net/simon/blog/archives/000652.html
while googling to answer your question. I didn't know that such things
are really possible with Python/Win32! It'll help me a lot. Thank you!

Ivan

If you guys are going to go digging into the PyWin32 modules, make
sure you check this site out:

http://aspn.activestate.com/ASPN/docs/ActivePython/2.5/pywin32/PyWin32.html

It has the docs for the distro and a link to the user's group too. Bot
have been very helpful to me.

Mike
 

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
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top