import pyautogui pyautogui.mouseInfo()
Once we install it, we can explore some of the functionality available in the pyautogui methods. The documentation shows good information on a lot of the commands, but some of the methods that will be most useful to us: moveTo(x,y) click() click(x,y,clicks,interval,button) optional arguments can be included! alert() confirm() prompt() locateOnScreen() looks for an image on screen and returns the first instance (left, top, width, height) locateAllOnScreen() looks for an image on screen and returns a tuple of instances locateCenterOnScreen() looks for an image and returns the (x,y) of the first instance - check out the documentation for more information on the screen image locate methods getpixel(x,y) returns the color of the pixel at a particular location note: I find typing in "pyautogui" a lot to be quite time consuming, so will usually assign a shorter name to the module. A useful function is the "info" method to help gather information about your screen """ import pyautogui as p p.mouseInfo()
def mouseInfo(self): import pyautogui pyautogui.mouseInfo()
def mouseInfo(self): self.minfo = pgui.mouseInfo() print(type(self.minfo))
import pyautogui #pyautogui.FAILSAFE = False pyautogui.PAUSE = 1 # 모든 동작에 1초씩 sleep 적용 pyautogui.mouseInfo() # 마우스 정보 열 for i in range(5): pyautogui.move(100, 100)
class AutoArknights: def __init__(self): print("auto_ark_nights init.") # 根目录路径 root_dir = os.getcwd() # 训练/验证用的资料目录 data_path = os.path.join(root_dir, 'image') # 测试用的图像 test_image = os.path.join(data_path, 'ASCII_Code.png') # 载入图像 # image = Image.open(test_image) # 存储图像并转换格式(jpg->png) # image.save(os.path.join(data_path, 'new_image.png')) # # plt.imshow(image) # plt.show() # pyautogui.mouseInfo() ''' pyautogui.mouseInfo() 705, 580 ''' pass if __name__ == '__main__': run()
def getinfogui(): pyautogui.mouseInfo()
def main(): image = pyautogui.screenshot() pix = pyautogui.pixel(1347, 105) print(pix) pyautogui.mouseInfo() sys.exit(0)