Answers for "python mouse.move in pynput"

1

pynput mouse position

from pynput.mouse import Button, Controller

mouse = Controller()

# Read pointer position
print('The current pointer position is {0}'.format(mouse.position))

# Set pointer position
mouse.position = (10, 20)
print('Now we have moved it to {0}'.format(mouse.position))

# Move pointer relative to current position
mouse.move(5, -5)

# Press and release
mouse.press(Button.left)
mouse.release(Button.left)

# Double click; this is different from pressing and releasing
# twice on Mac OSX
mouse.click(Button.left, 2)

# Scroll two steps down
mouse.scroll(0, 2)
Posted by: Guest on July-30-2020
0

how to use pynput mouse in python

from pynput.mouse import Button, Controller
mouse = Controller()

# move the pointer
mouse.position = (10, 20)

# Press and release
mouse.press(Button.left)
mouse.release(Button.left)

# Double click; this is different from pressing and releasing
mouse.click(Button.left, 2)

# Scroll two steps down
mouse.scroll(0, 2)
Posted by: Guest on March-27-2021

Python Answers by Framework

Browse Popular Code Answers by Language