Skip to content

made it so the listener is in non blocking mode, added a loop and check if you...

Simon requested to merge pixelpox/mouse-wheel-spinner:patch-1 into master

Hi Matt,

I have changed quite a bit while doing my own troubleshooting, feel free to use the code or not but at lease you will have a working example that you can fold into your own style :)

the main issue I found with your code was that the listener would block what you where doing and the code logic made it hard to detect another key.

so, on line 72 I put a non blocking listener in instead, i have linked to the source at the top if you want to know more.

because its non blocking it means that you need then to stop the script from just exiting so I added the while True loop on line 79.

the loop is then used to control the switching of scrolling on and off. (i assumed you want to do it a few times without restarting the app).

the sleep timers are moslty in the script to stop the script going full throttle, whifch means the script is easier to control when troubleshooting, it may be desirable to leave the timers in there but you can tweet/remove depending on what you want.

If you are wanting someone to use this and they have a fresh install remember to put in your docs that this script depends on pynput, I have put the pip command for this at the top of the script to save you digging for it :).

if you want anymore help or have any questions please feel free to get back to me :)

simon

Merge request reports