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!!!!!!!!!!!
-
1Welcome to Stackoverflow, please share what you have tried so far to make problem more clear for others otherwise no one will code for you.user11796003– user117960032020-09-28 11:37:56 +00:00Commented Sep 28, 2020 at 11:37
-
been trying to find stuff but failed so practically i have done nothing.Aryan tyagi– Aryan tyagi2020-09-29 10:59:40 +00:00Commented Sep 29, 2020 at 10:59
Add a comment
|
1 Answer
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/
3 Comments
Aryan tyagi
But won't that just simulate a scroll event? I want to record a scroll event
tudopropaganda
Read the mouse doc and you can accomplish that. github.com/boppreh/mouse#mouse.record
Aryan tyagi
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?