Questions tagged [pyautogui]

PyAutoGUI is a cross-platform GUI automation Python module used to programmatically control the mouse and keyboard.

Official document.

PyAutoGUI lets your Python scripts control the mouse and keyboard to automate interactions with other applications. The API is designed to be as simple. PyAutoGUI works on Windows, macOS, and Linux, and runs on Python 2 and 3.

PyAutoGUI has several features:

  • Moving the mouse and clicking or typing in the windows of other applications.
  • Sending keystrokes to applications (for example, to fill out forms).
  • Take screenshots, and given an image (for example, of a button or checkbox), find it on the screen.
  • Locate an application’s window, and move, resize, maximize, minimize, or close it (Windows-only, currently) Display message boxes for user interaction while your GUI automation script runs.
1828 questions
11
votes
1 answer

pyautogui: press two keys at the same time

I am using pyautogui to simulate pressing shift and end at the same time - when I type this myself, it highlights all the entries, however when I do it via the code below, it just moves to the end file - not highlighting every component, so it seems…
timr
  • 111
  • 1
  • 1
  • 3
11
votes
1 answer

How I can attach the mouse movement (pyautogui) to pyvirtualdisplay with selenium webdriver (python)?

I am trying to automatize a website how have a SWF inside. I cant move the mouse with selenium, because is a SWF,so to fix this I use the pyautogui library. Everything works fine!, but! when I use pyvirtualdisplay to hide the navigator the mouse is…
nguaman
  • 925
  • 1
  • 9
  • 23
10
votes
3 answers

Pyautogui mouse clicks without actually moving the mouse

I'd like to know if it's possible to automate clicks with pyautogui without compromising the funcionality of my cursor. I automate clicks with pyautogui but my cursor becomes useless while the script is running as the cursor moves around the screen.…
Gabriel Cesar
  • 327
  • 2
  • 4
  • 10
10
votes
4 answers

How can I locate something on my screen quickly in Python?

I've tried using the pyautogui module and i's function that locates an image on the screen pyautogui.locateOnScreen() but it's processing time is about 5-10 seconds. Is there any other way for me to locate an image on the screen more quickly?…
Darth Vador
  • 169
  • 2
  • 4
  • 12
10
votes
6 answers

Python: How can I find an image on screen by using: pyautogui lib?

The code is: import pyautogui startButton = pyautogui.locateOnScreen('start.png') print startButton Or: import pyautogui startButton = pyautogui.locateCenterOnScreen('start.png') print startButton The output is: None Note: the correct syntax…
george
  • 685
  • 2
  • 9
  • 22
9
votes
2 answers

Documentation says to use a confidence parameter, but it throws an error

Edit to include code snippet. I am developing an app with pyautogui. I want to match a region on the desktop and click it. Calling the locateOnscreen function, I pass the filename containing the image to match, along with a confidence parameter,…
undercoverincel
  • 89
  • 1
  • 1
  • 4
9
votes
5 answers

Move to searched text on active screen with pyautogui

I am trying to make a program that searches for a text on a web-page, then places the mouse cursor on the highlighted text after it has been found. Is this possible using pyautogui? If so, how. If not, are there any other alternatives to do…
ElectroMotiveHorse
  • 426
  • 1
  • 6
  • 16
9
votes
4 answers

How to know if the left mouse click is pressed

I am using PyAutoGUI library. How can I know if the left mouse button is pressed? This is what I want to do: if(leftmousebuttonpressed): print("left") else: print("nothing")
Coding4Life
  • 619
  • 2
  • 7
  • 14
8
votes
5 answers

pyautogui, screenshot function doesn't recognize installed Pillow module

I want to execute this code in Pycharm x, y = pyautogui.locateCenterOnScreen('LVL35.png') But I get this message ImportError: Pillow module must be installed to use screenshot functions on Windows. The thing is, I use anaconda and Pillow is…
Svenno Nito
  • 635
  • 1
  • 6
  • 22
8
votes
1 answer

Move mouse cursor to second monitor using pyautogui

I started using pyautogui about an hour ago. Very nice that python supports GUI automation. I'm having one problem though. I use two screens and it appears that the wrapper is unable to move my cursor to my secondary monitor. For instance: >>>…
user32882
  • 5,094
  • 5
  • 43
  • 82
8
votes
0 answers

PyQt5 - "Cannot set X11 selection owner" error when using .setMimeData() on Ubuntu 16.04

Keep Getting this error when using PyQt5's clipboard.setMimeData() QXcbClipboard::setMimeData: Cannot set X11 selection owner def copy(index, app): clipboard = app.clipboard() Mode = clipboard.Clipboard initialMimeData =…
DejaVu_Loop
  • 305
  • 2
  • 10
8
votes
4 answers

Pyautogui TypeError: 'NoneType' object is not iterable

I'm trying to use locateCenterOnScreen() function of PyAutoGUI, however it raises : Traceback (most recent call last): File "C:\Users\windows\Desktop\asd.py", line 3, in buttonx, buttony =…
GLHF
  • 3,835
  • 10
  • 38
  • 83
8
votes
1 answer

How to increase number of clicks per second with pyautogui?

I am developing a bot for timed mouse clicking game. I am using pyautogui. The aim is to click most times on a button in a minute. My code is: import pyautogui, time time.sleep(5) while True: pyautogui.click() The infinite loop is not the…
L_Pav
  • 281
  • 1
  • 3
  • 11
7
votes
2 answers

Install "libgiblib.so.1()(64bit)" on Fedora31 when it is not avaible

I am trying to install "scrot" on Fedora 31 and It requires that packet "libgiblib.so.1()(64bit)". localhost python]$ sudo dnf install scrot Fedora Modular 31 - x86_64 - Updates 52 kB/s | 42 kB 00:00 Fedora 31 - x86_64 - Updates…
bytef
  • 93
  • 3
7
votes
1 answer

How to automate without forfeiting keyboard/mouse control (similar to selenium's controlled window)

I had a little trouble phrasing this title, but allow me to explain. PyAutoGUIi allows you to automate anything by controlling your mouse and keyboard. However, if a pyAutoGUI script is running, it means you cannot touch your keyboard/mouse as its…
user11912594