Open carrot69 opened 3 months ago
Hey @m-jonas!
Sorry, I made a mistake with the variable name. I guess I'll need to refactor since I have two variables that are called the same but one with an underscore and the other with snake case.
Can you verify now?
Thanks!
Hey @carrot69
I'm afraid the error still the same.
Jonas
I have done some troubleshooting, where I have added a few print statements:
This is the outcome:
Observe that the currentPosition
tuple is deleted (?) as an object upon Windows lock.
More observations: I have tested and I believe it is pressing CTRL+ALT+DEL that kills the script somehow, and not the Windows lock action. I have tested it by pressing CTRL+ALT+DEL and then pressing ESC to go back, instead of selecting 'Lock'. I can then see the script has already failed.
Based on what you say and on this link: https://github.com/moses-palmer/pynput/issues/81
My best guess is that pynput returns the mouse position as None because the screen is locked.
I'm going to install Windows on a virtual machine so I can check this out and look for an elegant solution, but in the meanwhile you can try something like:
currentPosition = mouse.position
if currentPosition == None:
currentPosition = (0,0)
new_x = currentPosition[0] + delta_x
...
Does this work?
It worked!
Nice and simple solution :)
Yeah :D
I'm glad it worked!
I'm going to do a little refactoring and improve this pull request so I can push the fix to master.
Thanks for reporting this and helping debug it :)
No problem, glad to help!
Hi @carrot69
Thanks for looking into this. Just ran the code in this new branch but got the same error:
Jonas