Greetings,
I have what is hopefully a simple question. My program has a feature whereby users can press a hotkey to assign to a function which is then registered with RegisterHotkey. I'm accomplishing this by hooking wx.EVT_KEY_UP when the program is ready to receive input, and the resulting key-press is then decoded and passed to RegisterHotkey. Everything works except that, for some reason unbeknownst to me, presses of the win32con.MOD_WIN key are ignored. I'd like to use the Windows logo key in addition to Alt, Control, and Shift. Is this possible?
Thanks,
Steve
Hi,
Greetings,
I have what is hopefully a simple question. My program has a feature
whereby users can press a hotkey to assign to a function which is then
registered with RegisterHotkey. I’m accomplishing this by hooking
wx.EVT_KEY_UP when the program is ready to receive input, and the
resulting key-press is then decoded and passed to RegisterHotkey.
Everything works except that, for some reason unbeknownst to me, presses
of the win32con.MOD_WIN key are ignored. I’d like to use the Windows
logo key in addition to Alt, Control, and Shift. Is this possible?
Thanks,
Steve
Sadly there is no defined WXK_* code for it, but if you capture all keys you find out that it is 393. Then you can some fun with wx and monkey patch it:
wx.WXK_WINDOWS = 393
See the attached demo.
wxkeys.py (778 Bytes)
···
On Thursday, August 30, 2012 10:36:19 AM UTC-5, Stephen Clower wrote:
Thanks, Mike; this is helpful. Do you also know if there is any way to get WX to recognize the Windows key as a modifier, e.g. Windows-A, Windows-B, etc?
Steve
···
On 8/30/2012 2:10 PM, Mike Driscoll wrote:
Sadly there is no defined WXK_* code for it, but if you capture all keys you find out that it is 393. Then you can some fun with wx and monkey patch it:
wx.WXK_WINDOWS = 393
See the attached demo.
No, I do not. Hopefully Robin will jump in with some of his knowledge. I have a feeling that would require a patch of some sort.
···
On Thursday, August 30, 2012 1:25:35 PM UTC-5, Stephen Clower wrote:
On 8/30/2012 2:10 PM, Mike Driscoll wrote:
Sadly there is no defined WXK_* code for it, but if you capture all
keys you find out that it is 393. Then you can some fun with wx and
monkey patch it:
wx.WXK_WINDOWS = 393
See the attached demo.
Thanks, Mike; this is helpful. Do you also know if there is any way to
get WX to recognize the Windows key as a modifier, e.g. Windows-A,
Windows-B, etc?
Steve
I think you would need to do something like in OnKeyDown if key ==
wx.WXK_WINDOWS: self.WinKeyDown == True and the reverse in in an OnKeyUp
handler and then for the other keys check the state of self.WinKeyDown -
don't forget that you will need to stop the event propagating to stop
windows from handling it.
Gadget/Steve
···
On 30/08/2012 7:25 PM, Stephen Clower wrote:
On 8/30/2012 2:10 PM, Mike Driscoll wrote:
Sadly there is no defined WXK_* code for it, but if you capture all
keys you find out that it is 393. Then you can some fun with wx and
monkey patch it:
wx.WXK_WINDOWS = 393
See the attached demo.
Thanks, Mike; this is helpful. Do you also know if there is any way to
get WX to recognize the Windows key as a modifier, e.g. Windows-A,
Windows-B, etc?
Steve