PYAUTOGUI – Documentation

Welcome to PYAUTOGUI Documentation

PyAutoGUI is a python module is used to automate mouse , keyboards. This API is very easy to use. PyAutoGUI works on Windows , macOS and Linux.

Installing in winodws

pip install pyautogui 

Installing in macOS

$ pip3 install pyobjc-core 
$ pip3 install pyobjc 
$ pip3 install pyautogui

Installing in Linux

$ pip3 install python3-xlib 
$ pip3 install pyautogui

Functions of PyAutoGUI Module

import pyautogui

 screenWidth, screenHeight = pyautogui.size() # Get the size of the monitor.

 currentMouseX, currentMouseY = pyautogui.position() # Get the XY position of the mouse cursor.

 pyautogui.moveTo(100, 150) # Move the mouse to from one point to another          # Click the mouse left button, 200)  # Move the mouse to XY coordinates and click it.'button.png') # Find where button.png appears on the screen and click it.

 pyautogui.move(0, 10)      # Move mouse 10 pixels down from its current position.

 pyautogui.doubleClick()    # Double click the mouse.

 pyautogui.moveTo(250, 250, duration=3, tween=pyautogui.easeInOutQuad)  # Use tweening/easing function to move mouse over 2 seconds.

 pyautogui.write('Hello from ResolveMyQuery', interval=0.25)  # type with quarter-second pause in between each key'esc')     # Press the Esc key. All key names are in pyautogui.KEY_NAMES

 pyautogui.keyDown('shift') # Press the Shift key down and hold it.['left', 'left', 'left', 'left']) # Press the left arrow key 4 times.

 pyautogui.keyUp('shift')   # Let go of the Shift key.

 pyautogui.hotkey('ctrl', 'c') # Press the Ctrl-C hotkey combination.

 pyautogui.alert('This is the message to display.') # Make an alert box appear and pause the program until OK is clicked.

Leave a Comment