我想要截取确定区域的屏幕截图,并根据循环中的i保存图像,然后滚动并继续。当滚动工作时,我最终在每个文件夹上保存了一个图像,而我应该为每个文件夹保存5个图像。帮助?
import time
import pyautogui
import sys
i = 10
while i >=6:
pyautogui.moveTo(54,662)
pyautogui.dragTo(578,662,3, button='left')
pyautogui.mouseUp(button='left')
im = pyautogui.scree
我想写一个关于图像可能随时弹出的程序,而操作是关闭图像,而不是单击图像。我对代码有一些想法,但没有成功:(图像不是弹出,但仍然等待1秒,然后单击右上角conner .)
import pyautogui, time
while ture: pyautogui.click(pyautogui.center(pyautogui.locateOnScreen(r'C:\Users\Lawrence\Desktop\PyTest\image.png')))
time.sleep(1) #I want to check image every sec
break
pya
我一直在使用pyautogui自动化一些浏览器内容,如下所示:
time.sleep(1)
locationscs = pyautogui.locateOnScreen('scs.PNG', confidence=.8)
pyautogui.click(locationscs)
time.sleep(1)
这并不理想,因为有时页面没有及时加载,我也不会点击。
我试过这样的方法:
r = None
while r is None:
location3 = pya
Python3.9.7 pyautogui 0.9.53
让它查找图像,然后单击moveRel,但是它找不到它返回不可迭代的图像
我已经做了,以确保它找到了图像
while 1:
time.sleep(1)
if pyautogui.locateOnScreen('ScheduledBy.png', confidence=0.8) is not None:
print("Found")
else:
print
while pyautogui.locateOnScreen('white4x4.png', region = (200,200,4,4)) != None:
playsound('click.mp3')
if pyautogui.locateOnScreen('white4x4.png', region = (200,200,4,4)) == None:
continue
pyautogui拍摄了一个截图,检查我的图像是否在某个区域,我希望它继续重复。
playsound('click.mp3')
我使用python的pyautogui模型自动化软件安装。因此,我从安装屏幕上裁剪了一些图片,比如单击next,接受条款和条件。使用图像搜索,我能够找到屏幕上的图像,并能够点击正确的区域。在我的系统里很好。但是,由于图像搜索不成功,该脚本在其他系统中无法工作。可能是因为图像在我的系统中被裁剪,在其他系统中被搜索。这两个系统的分辨率是相同的,但屏幕大小不同(比如15英寸,17英寸)。我的问题是,locateOnScreen函数在不同的机器上兼容吗?考虑到我需要在公司的多个系统中部署这种自动化,我如何解决这个问题?该代码粘贴在下面:
import os
import time
import pya
我试图建立一个桌面机器人,自动促进society6上的艺术。现在,我只想让鼠标滚动到艺术图像上,一旦心形可见,就应该点击它。
我制作的程序
import pyautogui
i = 0
while i < 700:
pyautogui.moveTo(400,i,2)
i += 50
promote = pyautogui.locateOnScreen('heart.JPG')
x, y = pyautogui.center(promote)
pyautogui.click(x,y)
但是我得到了一个错误,找不到图像,我已经将图像保存在目录中程序的旁边。我该如何
我正在构建一个基于Pyautogui的Tkinter发布的简单程序,该程序必须单击certaing图像。这些图片每个月都会有变化,所以我想把这些图片放在一个网站上,每次需要的时候我都会更新它们,这样我就不用每次编译程序并重新发布了。示例
import pyautogui
# instead of this:
location=pyautogui.locateOnScreen('clickable_image.png')
pyautogui.click(location)
# I would like something like this:
location=pyautogu
import pyautogui
import time
dir = 'ingame/'
while True:
time.sleep(1)
test = pyautogui.locateOnScreen(dir + 'test2.png',grayscale=False,confidence=.7)
if test:
print('found')
这是我正在运行的代码,我有相同的图像,有和没有灰度。Pyautogui仍然以70%的置信度检测灰度图像,即使灰度设置为假.
1 https://imgur.
我正在使用PYautoGUI和im试图制作一个脚本来解决一个难题。这个谜题告诉我要点击这对(任何图像都有两个),到目前为止我有这样的代码:
if pyautogui.locateCenterOnScreen('TapPair.png', confidence=0.9, region=(689, 250, 640, 1000)) != None:
for image in images:
found = list(pyautogui.locateAllOnScreen(image, confidence=0.99, region=(689, 250
我有以下代码:
b_counter = False
while (b_counter == False):
if (pyautogui.locateOnScreen('editcheck.png') is not None):
pyautogui.click(pyautogui.center(pyautogui.locateOnScreen('home.png')))
b_counter = True
循环在运行时会延迟,有时会在图像加载后长达10秒。我的机器本身是相当快的(i7,16 i7,内存等等)。
我正在使用pyautogui截图我的当前屏幕,我想知道是否可以通过剪贴板访问该图像进行进一步处理?代码: import pyautogui
import time
x = 1
while x < 4:
capture = pyautogui.screenshot('/Users/Desktop/Screen/image'+str(x)+'.png')
x += 1
time.sleep(2) 谢谢。
我是Python的新手!我想定义一个小区域来读取图像,而不是搜索整个屏幕。我有下面的一些代码,但不成功:
import pyautogui, time
while True:
if pyautogui.screenshot(region=(666,0, 200, 200)pyautogui.locateOnScreen(r'C:\Users\Lawrence\Desktop\PyTest\image.png', grayscale=True)):
pyautogui.click(1880,15)
time.sleep(0.1)