I would like to make a small program that indicates to which position the mouse is moving (right, left, high, low, right and high, right and low ...), but I can not come to a logic that give this result.
Examples: If the Y and X are being incremented, then the mouse will be going up and right at the same time. If only X is being incremented, then the mouse will be going right. If the X is being decremented, the mouse is going to the left. And so on.
I'vethoughtofways,butnothingworks.Ifsomebodycanhelpme,Iappreciateitalot.
importpynputdefPosition():mouse=pynput.mouse.Controller()whileTrue:position_anterior=mouse.position[0]#mouse.positionretornaumatuplacom(x,y)position_atual=mouse.position[0]ifposition_atual>position_anterior:#print("direita")
elif position_atual < position_anterior:
print("esquerda")
elif position_atual == position_anterior:
print("parado")
Position()