0

So, hello everyone, I am a python, sort of beginner, programmer and recently I have the problem that for some reasons, I wanna use the mouse scroll wheel as a left-click, basically, rotating the scroll wheel once simulates the left click(or any key/click) once, I have been having difficulty in doing this so any help would be appreciated!!!!!!!!!!!

2
  • 1
    Welcome to Stackoverflow, please share what you have tried so far to make problem more clear for others otherwise no one will code for you. Commented Sep 28, 2020 at 11:37
  • been trying to find stuff but failed so practically i have done nothing. Commented Sep 29, 2020 at 10:59

1 Answer 1

1

You can install mouse package

pip install mouse

And then send custom mouse events to your program.

# scroll down
mouse.wheel(-1)

# scroll up
mouse.wheel(1)

# left click
mouse.click('left')

# right click
mouse.click('right')

# middle click
mouse.click('middle')

take a look at: https://pypi.org/project/mouse/

Sign up to request clarification or add additional context in comments.

3 Comments

But won't that just simulate a scroll event? I want to record a scroll event
Read the mouse doc and you can accomplish that. github.com/boppreh/mouse#mouse.record
Thanks dude but this will be inefficient because ill have to first record the scrolls, process them and then simulate, any way to keep them real time?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.