本文主要是介绍python辅助QQ登入,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
python辅助QQ登入
import pyautogui
import time
import random
from pyautogui import ImageNotFoundException# 生成随机等待时间,范围在1到3秒之间
random_time = random.uniform(1, 3)def find_and_click(image_path, move=False, execute_next=True):try:image_location = pyautogui.locateOnScreen(image_path, grayscale=True, confidence=0.8)if image_location:position = pyautogui.center(image_location)if move:pyautogui.moveTo(position, duration=0.5) #移动pyautogui.moveRel(30, 0, 0.1) #向右移动30pyautogui.doubleClick() #双击if not execute_next:return # 如果不执行后续语句,则直接返回pyautogui.doubleClick(position, duration=0.3)time.sleep(random_time)else:print(f"未找到指定的图片: {image_path}")except ImageNotFoundException:print(f"图片未找到,程序出现异常: {image_path}")# 循环执行 7 次
for _ in range(7):find_and_click('.\\images\\qq_login.bmp')find_and_click('.\\images\\login.bmp')find_and_click('.\\images\\qx.bmp', move=True, execute_next=False)
需要的图片
这篇关于python辅助QQ登入的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!