| | |
Keyboard Hook or something similar
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jul 2009
Posts: 3
Reputation:
Solved Threads: 0
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
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.
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
Python Syntax (Toggle Plain Text)
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.
Last edited by brandonhorst; Jul 12th, 2009 at 2:00 am.
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 
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
).
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'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
).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).
Last edited by shadwickman; Jul 12th, 2009 at 4:07 am.
"Two good old boys in a fire-apple red convertible. Stoned. Ripped. Twisted. Good people."
- Hunter S. Thompson
my photography
- Hunter S. Thompson
my photography
Glad I could help 
And welcome to DaniWeb haha.

And welcome to DaniWeb haha.
"Two good old boys in a fire-apple red convertible. Stoned. Ripped. Twisted. Good people."
- Hunter S. Thompson
my photography
- Hunter S. Thompson
my photography
![]() |
Similar Threads
- Keyboard Error - Gateway 600ygr Notebook (Motherboards, CPUs and RAM)
- How to create a Windows HOOK (C)
- Problem with the keyboard hooks (C#)
- Using Global Low-Level Hooks Without Using A Dll (Computer Science)
- Will Keyboard Hooks solve my problem? (C++)
- Application Hooks (C)
- Preventing Hooks (C++)
Other Threads in the Python Forum
- Previous Thread: Tkinter scrollbars
- Next Thread: function that modifies global variable of my choice
| Thread Tools | Search this Thread |
Tag cloud for Python
ansi assignment avogadro backend beginner binary bluetooth character cmd code customdialog cx-freeze data decimals dictionary drive dynamic error examples excel exe file float format ftp function gnu graphics gui heads homework http ideas import input java leftmouse line linux list lists logging loop module mouse number numbers output parsing path pointer port prime program programming progressbar projects push py2exe pygame pyqt python random recursion recursive refresh schedule screensaverloopinactive script scrolledtext sqlite ssh statistics stdout string strings sudokusolver sum table terminal text thread threading time tkinter tlapse tricks tuple tutorial ubuntu unicode update urllib urllib2 variable wikipedia windows write wxpython xlib





