skillfed

PyAutoGUI

PyAutoGUI lets Python control the mouse and keyboard, and other GUI automation tasks. For Windows, macOS, and Linux, on Python 3 and 2.

pyautogui v0.9.54 2.9M downloads/30d#2,815 on PyPI12,659
Permissive license BSD DORMANT released

What it is and what it does

PyAutoGUI is a cross-platform Python library that abstracts away the complexity of controlling the mouse and keyboard on Windows, macOS, and Linux. It provides a simple API to move the cursor, click, type, press keys, and perform other GUI automation tasks by hiding the platform-specific details—using ctypes and the Windows API on Windows, the Cocoa API on macOS, and Xlib on Linux.

The package also includes screenshot capture and image-location features (powered by Pillow) to find and interact with on-screen elements. It is commonly used for test automation, repetitive task scripting, and GUI interaction workflows. Installation requires platform-specific system dependencies and Pillow, and the package is currently dormant but remains stable and widely downloaded.

Use it for:

  • Automate repetitive GUI tasks such as form filling, data entry, or clicking through dialogs in applications without native APIs.
  • Write end-to-end GUI tests that simulate user interactions like mouse clicks, keyboard input, and screenshot verification.
  • Build scripts to control legacy applications or third-party software that lack programmatic interfaces.
  • Capture screenshots and locate UI elements on screen to enable conditional automation workflows.
  • Create accessibility tools or macros that simulate keyboard and mouse events for users with mobility constraints.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

PyAutoGUI programmatically controls the mouse and keyboard across Windows, macOS, and Linux, enabling GUI automation tasks like clicking, typing, and taking screenshots.

Yes, with conditions. PyAutoGUI is worth installing if you need cross-platform GUI automation and can manage its platform-specific dependencies (pyobjc on macOS, python3-xlib on Linux, Pillow everywhere). The package is stable, permissively licensed, and widely used, but it is dormant—last released in May 2023—so expect no active maintenance. It works reliably on the primary monitor only and is best suited for scripting and testing, not production services.

Install

pyautogui on PyPI

pip

pip install pyautogui

uv

uv add pyautogui

poetry

poetry add pyautogui

Installing PyAutoGUI

Before you install

Installation friction is high due to platform-specific system dependencies: Windows requires no extras, macOS requires pyobjc-core and pyobjc, and Linux requires python3-xlib. Pillow is also required and may need additional system libraries for PNG/JPEG support on Linux. The package is dormant (last release 2023-05-24, last commit 2024-08-20) but remains widely used.

License in practice

BSD license is permissive, allowing commercial and private use with minimal restrictions. You may use, modify, and distribute this package freely provided you include the original license notice.

Quickstart

pip install pyautogui

import pyautogui

# Move mouse and click
pyautogui.moveTo(100, 150)
pyautogui.click()

# Type text
pyautogui.write('Hello world!')

# Take screenshot
im = pyautogui.screenshot()
im.save('screenshot.png')

Platform-specific dependencies required: pyobjc-core and pyobjc on macOS; python3-xlib on Linux. Pillow must be installed and may require system libraries for image support on Linux.

Verify before relying

  • Whether multi-monitor support has improved since the documented limitation to primary monitor only
  • Current stability and bug-fix status given dormant maintenance (last release over 2 years old)

Package facts

License BSD (permissive)
Python support not specified
Install friction high — source build required
Runtime dependencies none
Maintenance dormant — 1,178 days since the last release
Last repo commit
First released
Downloads 2,940,189/month — #2,815 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: PyAutoGUI-0.9.54.tar.gz

Keywords: gui, automation, test, testing, keyboard, mouse, cursor, click, press, keystroke, control

Development Status :: 4 - BetaEnvironment :: MacOS XEnvironment :: Win32 (MS Windows)Environment :: X11 ApplicationsIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.1Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.2Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

gui automation mouse keyboard controlprogrammatic mouse and keyboard controlcross-platform gui automationautomated mouse clicks and typingscreenshot and image location on screendesktop automation pythonsimulate keyboard and mouse events
gui-automationcross-platformtesting

More Testing packages