When I’m using the mouse.move()
function with the Pynput package, the mouse does not stop moving when it reaches the edge of the screen. For example with the following code:
from pynput.mouse import Controller
mouse = Controller()
while 1:
mouse.move(0,-10)
print(mouse.position)
time.sleep(2)
The mouse position printed will keep going more and more negative even when it hits the edge of the screen. I can manually constrain the cursor position based on the screen size but is there a built in function that will do this with Pynput or any other Python package?
I do not want the cursor to move off the screen even when the mouse.move()
function says to.