Lucas Jones Lucas Jones - 4 months ago 25
Python Question

Change keyboard locks in Python

Is there any way, in Python, to programmatically change the CAPS LOCK/NUM LOCK/SCROLL LOCK states?

This isn't really a joke question - more like a real question for a joke program. I intend to use it for making the lights do funny things...

Answer

If you're using windows you can use SendKeys for this I believe.

http://www.rutherfurd.net/python/sendkeys/

import SendKeys

SendKeys.SendKeys("""
{CAPSLOCK}
{SCROLLOCK}
{NUMLOCK}
""")
Comments