Python Forum

Full Version: switch mouse buttons
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I realize this could this question could be tagged as "dumb",
but I am not familiair with Python yet, and before I dive into it I need to know if Python can do this:

question:
Is Python being able to switch mouse buttons? So left mouse button click functions as right-mouse button click, and vice versa?

As answers (for now), before I dive into Python myself would be:
"yes" , or "no"

additionaly "yes" accompanied by a small code example, would be appreciated.

Thanks
Your mouse is being read by the operating system and the clicks and movements passed from that into your python programs. You could use python to change your OS's options or edit your registry (Windows) but that seems silly since it's much easier to just change it manually.

If you want it so the buttons are swapped just when you use your python program then you could intercept the mouse clicks and swap them using python modules like mouse or pynput.
@marbelous:

thanks for the reaction. The point is I want to design/write a Python progam that will switch automatically at set intervals.