Hey Folks.

I'm writing a Python app using wx and I'd really like the ability to block the Capslock key at certain times. My current system has some unfortunate toggling of Hotkey Bindings and uses SendKeys, which results in some ugly keyboard light flashing and some seemingly random infinite loops. I'd really just like to disable the Capslock mode entirely.

I don't know if any of you are familiar with Autohotkey, but I'm essentially looking for

SetCapsLockMode, AlwaysOff

PyHook has what I'm looking for, but I'd really rather not switch back to Python 2.5 if that was at all possible. So is there any behavior like a hook built into wx, or is there some other library that I could use? I've searched quite a bit and I'm at a loss.

It only needs to work on Windows. Thanks alot, folks.

Hooray! I got pyHook working with Python 2.6 for Windows. I just downloaded the source and edited a few things, hacked it together and built. As far as I know, it all works with 2.6 :D
You'd just need to manually install it to your Python's site-packages directory if you want it to be available like any other module.

You can do this on your own, or you can grab the zipped build that I have uploaded here (a much easier method :P).

If you want to install it into your site-packages folder, navigate to it (C:\Python26\Lib\site-packages) and copy the pyHook folder into it. Then create a file in the site-packages folder named "pyHook.pth" and in it, type "pyHook". That's all. Now you should be able to pop-up IDLE and type "import pyHook" without any errors. Good luck!

EDIT:
This is tested and worked without error for me :)
And note, you'll need the win32 modules for Python 2.6 by Mark Hammond (here).

You are my hero.
Thanks so much, dude. You just made my life WAY easier.

This site is freaking sweet.

Glad I could help :)
And welcome to DaniWeb haha.

Please i don't know if there is a way i can go about it the same way on 2.7 i have problems installing it from the installer

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.