Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

controlling the mouse with pynput

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 macOS
mouse.click(Button.left, 2)

# Scroll two steps down
mouse.scroll(0, 2)
Comment

PREVIOUS NEXT
Code Example
Python :: split() vs split() 
Python :: python replace negative infinity 
Python :: Total processing python 
Python :: |= operator python 
Python :: python monitor directory for files count 
Python :: maximize difference codechef 
Python :: sqlite3 python parameterized query insert into 
Python :: np array size 
Python :: pythagoras theorem formula 
Python :: scrapy get text custom tags 
Python :: backend in python 
Python :: python import from string name 
Python :: how to specify root geometry in tkinter 
Python :: django set default value for model not form 
Python :: python selenium console log 
Python :: django admin.py date format 
Python :: model.predict Decision Tree Model 
Python :: do while python 
Python :: detect gender from name 
Python :: replace all occurrences of a value to nan in pandas 
Python :: convert string to integer in python 
Python :: bitwise xor in python 
Python :: numpy maximum 
Python :: can list hold different data types in python 
Python :: random.randint(0,20) + pyrthon 
Python :: destory image in pygame 
Python :: how to write a function in python 
Python :: python typing 
Python :: python herencia 
Python :: how to add axis labels to a plotly barchart 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =