asweigart/pyautogui is tracked by TopGit as an open-source project, with 12.8k stars on GitHub, written primarily in Python. A cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
If you want to do development and contribute to PyAutoGUI, you will need to install these modules from PyPI:
pyscreeze
pymsgbox
pytweening
Example Usage
Keyboard and Mouse Control
The x, y coordinates used by PyAutoGUI has the 0, 0 origin coordinates in the top left corner of the screen. The x coordinates increase going to the right (just as in mathematics) but the y coordinates increase going down (the opposite of mathematics). On a screen that is 1920 x 1080 pixels in size, coordinates 0, 0 are for the top left while 1919, 1079 is for the bottom right.
Currently, PyAutoGUI only works on the primary monitor. PyAutoGUI isn't reliable for the screen of a second monitor (the mouse functions may or may not work on multi-monitor setups depending on your operating system and version).
All keyboard presses done by PyAutoGUI are sent to the window that currently has focus, as if you had pressed the physical keyboard key.
>>> import pyautogui
>>> screenWidth, screenHeight = pyautogui.size() # Returns two integers, the width and height of the screen. (The primary monitor, in multi-monitor setups.)
>>> currentMouseX, currentMouseY = pyautogui.position() # Returns two integers, the x and y of the mouse cursor's current position.
>>> pyautogui.moveTo(100, 150) # Move the mouse to the x, y coordinates 100, 150.
>>> pyautogui.click() # Click the mouse at its current location.
>>> pyautogui.click(200, 220) # Click the mouse at the x, y coordinates 200, 220.
>>> pyautogui.move(None, 10) # Move mouse 10 pixels down, that is, move the mouse relative to its current position.
>>> pyautogui.doubleClick() # Double click the mouse at the
>>> pyautogui.moveTo(500, 500, duration=2, tween=pyautogui.easeInOutQuad) # Use tweening/easing function to move mouse over 2 seconds.
>>> pyautogui.write('Hello world!', interval=0.25) # Type with quarter-second pause in between each key.
>>> pyautogui.press('esc') # Simulate pressing the Escape key.
>>> pyautogui.keyDown('shift')
>>> pyautogui.write(['left', 'left', 'left', 'left', 'left', 'left'])
>>> pyautogui.keyUp('shift')
>>> pyautogui.hotkey('ctrl', 'c')
Display Message Boxes
>>> import pyautogui
>>> pyautogui.alert('This is an alert box.')
'OK'
>>> pyautogui.confirm('Shall I proceed?')
'Cancel'
>>> pyautogui.confirm('Enter option.', buttons=['A', 'B', 'C'])
'B'
>>> pyautogui.prompt('What is your name?')
'Al'
>>> pyautogui.password('Enter password (text will be hidden)')
'swordfish'
Screenshot Functions
(PyAutoGUI uses Pillow for image-related features.)
You can also locate where an image is on the screen:
>>> import pyautogui
>>> button7location = pyautogui.locateOnScreen('button.png') # returns (left, top, width, height) of matching region
>>> button7location
(1416, 562, 50, 41)
>>> buttonx, buttony = pyautogui.center(button7location)
>>> buttonx, buttony
(1441, 582)
>>> pyautogui.click(buttonx, buttony) # clicks the center of where the button was found
The locateCenterOnScreen() function returns the center of this match region:
>>> import pyautogui
>>> buttonx, buttony = pyautogui.locateCenterOnScreen('button.png') # returns (x, y) of matching region
>>> buttonx, buttony
(1441, 582)
>>> pyautogui.click(buttonx, buttony) # clicks the center of where the button was found
How Does PyAutoGUI Work?
The three major operating systems (Windows, macOS, and Linux) each have different ways to programmatically control the mouse and keyboard. This can often involve confusing, obscure, and deeply technical details. The job of PyAutoGUI is to hide all of this complexity behind a simple API.
On Windows, PyAutoGUI accesses the Windows API (also called the WinAPI or win32 API) through the built-in ctypes module. The nicewin module at https://github.com/asweigart/nicewin provides a demonstration for how Windows API calls can be made through Python.
On macOS, PyAutoGUI uses the rubicon-objc module to access the Cocoa API.
On Linux, PyAutoGUI uses the Xlib module to access the X11 or X Window System.
Support
If you find this project helpful and would like to support its development, consider donating to its creator on Patreon.
No homepage URL was recorded for asweigart/pyautogui in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
Does asweigart/pyautogui have any tags?
TopGit's last sync did not record any GitHub topics for asweigart/pyautogui. GitHub topics appear in the right sidebar of a repository page; that's the authoritative place to check.
How active is development on asweigart/pyautogui?
The most recent commit recorded on asweigart/pyautogui was 2.2 years ago, based on the GitHub push timestamp. The repository has 1.4k forks — one of the better signals of community interest.
How many stars does asweigart/pyautogui have?
asweigart/pyautogui has 12.8k GitHub stars — refresh the page for the live number, or check github.com/asweigart/pyautogui. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What language is asweigart/pyautogui written in?
asweigart/pyautogui is written primarily in Python. GitHub's language field is based on the largest share of bytes in the default branch.
What license does asweigart/pyautogui use?
asweigart/pyautogui is released under the BSD-3-Clause license. Always verify the LICENSE file directly on GitHub for the authoritative terms — license strings can be edited out of sync with a project's actual stance.
Where do I read more about asweigart/pyautogui?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/asweigart/pyautogui is the definitive source.
Read full README in the tab above.
Curious whether pyautogui is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about pyautogui.