Using ; and / as global hotkeys

71 views
Skip to first unread message

Ram Rachum

unread,
Aug 29, 2012, 5:07:33 AM8/29/12
to wxpytho...@googlegroups.com
Hello all!

I'd like to use keys ; and / as global hotkeys. Does anyone have a clue what their codes are?


Thanks,
Ram.

Cody

unread,
Aug 29, 2012, 8:41:06 AM8/29/12
to wxpytho...@googlegroups.com
print ord(';')
print ord('/')
> --
> To unsubscribe, send email to wxPython-user...@googlegroups.com
> or visit http://groups.google.com/group/wxPython-users?hl=en

Ram Rachum

unread,
Aug 29, 2012, 8:45:38 AM8/29/12
to wxpytho...@googlegroups.com
Doesn't work.

Cody

unread,
Aug 29, 2012, 8:50:03 AM8/29/12
to wxpytho...@googlegroups.com
On Wed, Aug 29, 2012 at 6:45 AM, Ram Rachum <r...@rachum.com> wrote:
> Doesn't work.
>

What doesn't work?

The ord function certianly returns the character codes of those characters.

If thats not what your looking for then I don't know what "Does anyone
have a clue what their codes are?" means and you may want to
elaborate further.

Ram Rachum

unread,
Aug 29, 2012, 8:52:53 AM8/29/12
to wxpytho...@googlegroups.com
Sorry, I meant codes in the context of setting a global hotkey. i.e., the codes that I need to pass to RegisterHotKey.

Cody

unread,
Aug 29, 2012, 9:20:32 AM8/29/12
to wxpytho...@googlegroups.com
On Wed, Aug 29, 2012 at 7:52 AM, Ram Rachum <r...@rachum.com> wrote:
> Sorry, I meant codes in the context of setting a global hotkey. i.e., the
> codes that I need to pass to RegisterHotKey.
>

RegisterHotKey only works under Windows:

http://docs.wxwidgets.org/2.8/wx_wxwindow.html#wxwindowregisterhotkey
http://wiki.wxpython.org/RegisterHotKey
http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx

Andrea Gavana

unread,
Aug 29, 2012, 9:38:52 AM8/29/12
to wxpytho...@googlegroups.com
Not quite:

http://docs.wxwidgets.org/2.9.4/classwx_window.html#a53ca57872dac5851ea6ba55a494b899b
http://wxpython.org/Phoenix/docs/html/Window.html#Window.RegisterHotKey

Or at least I can't see any Windows-specific remarks on that method.

Anyway, I have no idea if Linux or Mac implementation actually work,
so that may just be incomplete documentation.

For the virtual hotkeys, on US keyboards only, MS reports this:

1) ';' ==> 0xba
2) '/' ==> 0xbf

Personal suggestion: don't use them :-)


Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

# ------------------------------------------------------------- #
def ask_mailing_list_support(email):

if mention_platform_and_version() and include_sample_app():
send_message(email)
else:
install_malware()
erase_hard_drives()
# ------------------------------------------------------------- #

Cody

unread,
Aug 29, 2012, 9:47:03 AM8/29/12
to wxpytho...@googlegroups.com
Hi,

On Wed, Aug 29, 2012 at 8:38 AM, Andrea Gavana <andrea...@gmail.com> wrote:
> On 29 August 2012 15:20, Cody wrote:
>> On Wed, Aug 29, 2012 at 7:52 AM, Ram Rachum <r...@rachum.com> wrote:
>>> Sorry, I meant codes in the context of setting a global hotkey. i.e., the
>>> codes that I need to pass to RegisterHotKey.
>>>
>>
>> RegisterHotKey only works under Windows:
>>
>> http://docs.wxwidgets.org/2.8/wx_wxwindow.html#wxwindowregisterhotkey
>> http://wiki.wxpython.org/RegisterHotKey
>> http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
>
> Not quite:
>
> http://docs.wxwidgets.org/2.9.4/classwx_window.html#a53ca57872dac5851ea6ba55a494b899b
> http://wxpython.org/Phoenix/docs/html/Window.html#Window.RegisterHotKey
>
> Or at least I can't see any Windows-specific remarks on that method.
>

Did you check the remarks section of that documentation in your link ;-)



Cody

Andrea Gavana

unread,
Aug 29, 2012, 9:52:36 AM8/29/12
to wxpytho...@googlegroups.com
Note Use EVT_HOTKEY(hotkeyId, fnc) in the event table to capture the
event. This function is currently only implemented under Windows. It
is used in the Windows CE port for detecting hardware button presses.
"""

From what I understand, it appears you can register a hotkey on any
platform but you can handle the event only on Windows. Very funny (and
useful) indeed :-)

Ram Rachum

unread,
Aug 29, 2012, 12:02:49 PM8/29/12
to wxpytho...@googlegroups.com
Thanks everybody. Andrea, the codes you supplied work great.

Reply all
Reply to author
Forward
0 new messages