How do I get the mouse dx and dy even when the mouse is locked from Python?
I have been trying to get the deltas of the mouse cursor through python, I can easily get the position however I am trying to train a machine learning model with some video game play that I will be creating, which the mouse' position will be locked by the game.
I have already tried using pynput, and again it works using the listeners however that is only the positions, what I need are the change in mouse position, I am fairly certain it is possible to do, but every search I do comes up with the solution of just grab the mouse position!
For Mouse position tracking, you can use
pyautoguilibrary and it will do the job , it has.position()function , that returns current x , y position for the mouse cursor instantly.For the deltas we can calculate by storing the previous positions and calculate the difference between the current position and previous to get the deltas , and if you need to get the rate of change ,
you can do it as
( curr_y - prev_y )/( curr_x - prev_x ).sample code ,