pyautogui

How to attach pyautogui to the virtual display?

丶灬走出姿态 提交于 2019-12-23 05:01:29
问题 How do I attach pyautogui to the display in multithreaded mode? In the example of my code, pyautogui always has access to the upper display. Is it possible to have pyautogui control on each display? import os from selenium import webdriver from pyvirtualdisplay import Display import Xlib.display # ... # let's say i run this function in two threads def do_work(data): v_display = Display(visible=0, size=(900, 600)) v_display.start() # How can i attach v_display to the pyautogui? import

Python 3- pyautogui can't use screen shot functions

六眼飞鱼酱① 提交于 2019-12-23 01:04:18
问题 Python 3.6.4 Pillow (PIL) 5.0 OS Win 7 pyscreeze 0.1.13 I'm trying to utilize the screenshot functions with pyautogui, but encountering an issue. import pyautogui image = pyautogui.locateOnScreen('imagepath') print(image) I'm receiving the following error: File "C:\Users\a7153\AppData\Local\Programs\Python\Python36\lib\site-packages\pyscreeze__init__.py", line 315, in _screenshot_win32 im = ImageGrab.grab() NameError: name 'ImageGrab' is not defined I've tried going to pyscreeze and directly

Embedded Python 3.5 “python setup.py egg_info” failed with error code 1

隐身守侯 提交于 2019-12-22 12:38:13
问题 I am attempting to "pip install" PyAutoGUI ( among other modules ) and I am getting the following error : Collecting pyautogui Using cached PyAutoGUI-0.9.35.zip Complete output from command python setup.py egg_info: running egg_info creating pip-egg-info\PyAutoGUI.egg-info writing top-level names to pip-egg-info\PyAutoGUI.egg-info\top_level.txt writing requirements to pip-egg-info\PyAutoGUI.egg-info\requires.txt writing pip-egg-info\PyAutoGUI.egg-info\PKG-INFO writing dependency_links to pip

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

不打扰是莪最后的温柔 提交于 2019-12-20 14:24:03
问题 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 not attached, so I still see how pyautogui move my mouse. My example code: from selenium import webdriver from pyvirtualdisplay import Display import pyautogui display = Display(visible=1, size=(1600,900)) display.start() driver = webdriver.Firefox

What is wrong with using a bare 'except'? [duplicate]

▼魔方 西西 提交于 2019-12-19 12:31:11
问题 This question already has answers here : About catching ANY exception (8 answers) Closed 10 months ago . I tried making a function to check if an image is displayed on the screen using PyAutoGui and came up with this: def check_image_on_screen(image): try: pyautogui.locateCenterOnScreen(image) return True except: return False And it works fine, but PyCharm tells me I shouldn't leave except bare. What is the problem with leaving it like this? Is there a more appropriate way of creating the

import error for pyautogui

别等时光非礼了梦想. 提交于 2019-12-19 06:46:38
问题 I installed the pyautogui module and dependencies via pip-3.2 on my raspi correctly, However when I am trying to do import pyautogui I am getting an import error: ImportError: No module named pyautogui What am I doing wrong? Did the command change? Sorry I am a total python Noob, any help is greatly appreciated :D 回答1: It might be because you're trying it from a python 2.x shell. Instead try this command on a python3 shell and try importing the same. 回答2: True you would have to use python 3.

How to type @ using pyautogui

ぃ、小莉子 提交于 2019-12-13 07:54:47
问题 I am using pyautogui in python 2.7.x and I need to write the character " @ ". I've tried everything I know but I got no results. What code line/s should let me write the " @ "? 回答1: Maybe you can try use the following code: import pyautogui pyautogui.hotkey('shift', '2') If that does not work, try replacing hotkey with hotkeys 来源: https://stackoverflow.com/questions/53585433/how-to-type-using-pyautogui

Multithreaded pyautogui validations stop working after 40~60 minutes

我的梦境 提交于 2019-12-13 03:45:45
问题 AI Sweigart, I am having problems with your pyautogui. I made a bot for a game that uses your lib: multithreaded infinite loops based on checked actions that activate it, validating screen matches and images, and it works perfectly for 40~50 minutes. But, suddenly, it stops working, and today I found out that it happens on the locateOnScreen and/or PixelMatchesColor validations. The error is 'screen grab failed', and this keep happening until I finish the application and run it again. How can

Python: 'pyautogui' has no attribute 'screenshot' (Windows)

瘦欲@ 提交于 2019-12-12 22:34:34
问题 I am trying to take a screenshot with the pyautogui module, but keep getting this error >>> image = pyautogui.screenshot() Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: module 'pyautogui' has no attribute 'screenshot' Is there something I'm missing? The chapter in Automate the Boring Stuff with Python said that as I'm on Windows, I shouldn't need to download anything other than pyautogui itself for this to work. Anyone know why this might happen?

pyautogui crashes whenever it clicks

▼魔方 西西 提交于 2019-12-12 13:35:11
问题 basicly whenever I call pyautogui to click it does it but then crashes the program. here is the program: import pyautogui import time pyautogui.click(650, 200, 10) print("started") while 2 == 2: x+1 waittime = random.randrange(35, 40, 1) pyautogui.click(600, 680, waittime) pyautogui.click(1270, 0, 5) if (x % 4) == 0: pyautogui.click(600, 550, 4) when I run it from the command prompt I get this error Traceback (most recent call last): File "C:\Users\dogja\Desktop\crap\region2\scriptybob\test