pyautogui

pip3 install pyautogui fails with error code 1 Mac OS

半腔热情 提交于 2019-12-07 15:53:49
问题 I tried installing the autogui python extension: pip3 install pyautogui And this installation attempt results in the following error message: Collecting pyautogui Using cached PyAutoGUI-0.9.33.zip Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> File "/private/var/folders/00/zcr6mkx90hg7kr4x_ks6nhhw0000gn/T/pip-build-edy15oyn/pyautogui/setup.py", line 6, in <module> version=__import__('pyautogui').__version__, File

Copy highlighted text to clipboard, then use the clipboard to append it to a list

耗尽温柔 提交于 2019-12-06 05:06:50
问题 I'm trying to automate some actions in a browser or a word processor with pyautogui module for Python 3 (Windows 10). There is a highlighted text in a browser. text the following script should print the highlighted text import pyautogui as pya # double clicks on a position of the cursor pya.doubleClick(pya.position()) list = [] # a function copy_clipboard() should be called here var = copy_clipboard() list.append(var) print(list) The output should be: [text] So how should the function copy

Pyautogui TypeError: 'NoneType' object is not iterable

淺唱寂寞╮ 提交于 2019-12-06 03:44:22
问题 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 <module> buttonx, buttony = pyautogui.locateCenterOnScreen('who.jpg') TypeError: 'NoneType' object is not iterable My code is: import pyautogui buttonx, buttony = pyautogui.locateCenterOnScreen('who.jpg') pyautogui.doubleClick(buttonx,buttony) How can I fix this problem? 回答1: From the documentation of Pyautogui here, the

Pyautogui don't work in game window

不想你离开。 提交于 2019-12-05 17:52:30
I'm making some tests using Pyautogui on games. But in those games that change your cursor and fullscreen games, none of the methods work. I'm trying now on Ragnarok Online. I tried: pyautogui.click() pyautogui.moveTo(x, y, time) pyautogui.moveRel(x, y) None of them works when inside the game window. They work fine outside. Is there a way to make it work? Or another library that I could use? By the way, win32api.SetCursorPos((x,y)) also doesn't work. Thanks. obgnaw The source code of Pyautogui def _sendMouseEvent(ev, x, y, dwData=0): assert x != None and y != None, 'x and y cannot be set to

Windows Desktop GUI Automation using Python - Sleep vs tight loop

ぃ、小莉子 提交于 2019-12-05 02:15:30
问题 I am using PyAutoGUI library of Python to automate GUI. The application which I am automating opens a new window after I am done with data entry on my current window. Everything is taken care by python automation (data entry in my current window and the click required to open the window). When the click is performed in the current window, the new window takes some time to open (which may range from 2 - 5 seconds). So there are two options that I can think of here: Sleep using time.sleep(5)

pyautogui doesn't let me select text

此生再无相见时 提交于 2019-12-04 15:29:22
I want to select some text on the screen. I figured using pyautogui would be the way to go. I did the following: keyDown('shift') sleep(0.1) press('end') sleep(0.1) keyUp('shift') When doing this exact combination by hand it does select the text I want it to. Of course the sleep function is from the time module. I even tried to select text in word using the following: keyDown('shift') press('right') press('right') keyUp('shift') And even this didn't work... Does anyone know why? Thanks in advance! I found the answer! Finally! It wasn't selecting text for me as long as NUM LOCK was enabled . (I

How can I invert the cursor movement in python?

亡梦爱人 提交于 2019-12-04 10:37:10
问题 In this code, I'm using Python 2.7.13, OpenCV 2.4.13 and PyAutoGUI 0.9.36. The objective is to move the cursor according to the facial movement, but the cursor movement is inverted. For example, if my face goes to right, the cursor moves to left and if my face goes to left, the cursor goes to right. Also, I want the cursor to move right, left, up and down in the whole screen of my PC, whose size is x=1920, y=1080. The purpose of this program is to show that it is possible to get a new way to

Windows Desktop GUI Automation using Python - Sleep vs tight loop

我们两清 提交于 2019-12-03 17:15:33
I am using PyAutoGUI library of Python to automate GUI. The application which I am automating opens a new window after I am done with data entry on my current window. Everything is taken care by python automation (data entry in my current window and the click required to open the window). When the click is performed in the current window, the new window takes some time to open (which may range from 2 - 5 seconds). So there are two options that I can think of here: Sleep using time.sleep(5) (Con: 3 seconds might be wasted unnecessarily) Spin in a tight loop till the window appears on the screen

Move mouse cursor to second monitor using pyautogui

五迷三道 提交于 2019-12-03 16:12:46
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: >>> import pyautogui >>> pyautogui.moveTo(2759,769) >>> pyautogui.position() (1919, 769) As you can see the cursor is still within my first screen. How do I force pyautogui to move to my second screen? Thanks Nevermind, I have found the answer from a github post . It appears that moving the cursor to a second monitor can be accomplished using ctypes.windll

How can I invert the cursor movement in python?

百般思念 提交于 2019-12-03 05:46:30
In this code, I'm using Python 2.7.13, OpenCV 2.4.13 and PyAutoGUI 0.9.36. The objective is to move the cursor according to the facial movement, but the cursor movement is inverted. For example, if my face goes to right, the cursor moves to left and if my face goes to left, the cursor goes to right. Also, I want the cursor to move right, left, up and down in the whole screen of my PC, whose size is x=1920, y=1080. The purpose of this program is to show that it is possible to get a new way to acquire more independence and access so that people with tetraplegia are capable of doing the simple