首页
社区
课程
招聘
Python自制自动连点器
发表于: 2024-12-12 17:07 10454

Python自制自动连点器

2024-12-12 17:07
10454

最近玩雷霆战机,但是金币又很少,百度搜了看可以用自动连点器刷无尽,但是我手机不可能24小时挂着,模拟器又需要把微信退出去,就找pc版的连点器吧,找了好几个都要RMB,GitHub上也少,就自己用py写一个吧,简简单单,可以定时,多点位就能满足,下面贴上代码和运行效果:

c5dK9s2c8@1M7s2y4Q4x3@1q4Q4x3V1k6Q4x3V1k6%4N6%4S2$3i4K6u0W2L8r3q4F1P5X3!0#2L8q4)9J5k6h3y4G2L8g2)9J5c8X3t1H3k6X3!0&6x3r3f1&6j5H3`.`.
密码:2f5o

附上GitHub地址:4c5K9s2c8@1M7s2y4Q4x3@1q4Q4x3V1k6Q4x3V1k6Y4K9i4c8Z5N6h3u0Q4x3X3g2U0L8$3#2Q4x3V1k6e0N6r3g2H3K9r3g2F1h3g2S2o6i4K6u0r3b7i4g2@1L8@1y4D9K9h3y4C8i4@1g2r3i4@1u0o6i4K6S2o6i4@1f1&6i4@1u0o6i4@1p5H3i4@1f1$3i4@1p5H3i4K6R3%4i4@1f1#2i4K6W2p5i4K6V1H3i4@1f1$3i4@1p5H3i4K6R3%4i4@1f1#2i4@1q4q4i4K6W2q4i4@1f1$3i4K6V1%4i4@1t1$3i4@1f1@1i4@1u0p5i4K6S2p5i4@1f1%4i4@1u0p5i4@1q4q4i4@1f1$3i4K6W2m8i4K6R3J5i4@1f1$3i4K6V1%4i4@1t1$3i4@1f1@1i4@1t1^5i4K6S2p5i4@1f1^5i4K6R3K6i4@1u0p5i4@1f1$3i4K6R3&6i4K6V1K6i4@1f1#2i4K6S2o6i4K6R3#2i4@1f1#2i4K6V1H3i4K6S2q4i4@1f1#2i4@1q4q4i4K6W2q4i4@1f1%4i4K6S2q4i4@1t1H3i4@1g2r3i4@1u0o6i4K6S2o6i4@1f1$3i4K6W2o6i4K6R3&6i4@1f1$3i4K6R3%4i4K6R3J5i4@1f1%4i4K6W2m8i4K6R3@1i4@1f1#2i4K6S2r3i4@1q4r3i4@1f1@1i4@1u0n7i4@1p5#2i4@1f1$3i4K6S2r3i4K6V1H3i4@1f1%4i4@1p5@1i4@1u0m8i4@1f1@1i4@1t1^5i4K6S2n7i4@1g2r3i4@1u0o6i4K6S2o6M7s2W2F1M7s2g2@1i4@1f1%4i4K6W2m8i4K6R3@1i4@1f1#2i4@1u0m8i4K6V1K6

图片描述

# -*- coding: utf8 -*-
import time,re,os,pickle
import tkinter as tk
from tkinter import messagebox,ttk
import pyautogui
import keyboard
import logging
import threading
  
# 初始化一个空列表来保存坐标点
coordinates = []
# 声明一个全局变量,用于控制循环的启动和停止
is_running = False
click_count = 0  # 循环计数器
clickNum = 0 # 标记
  
# 设置日志记录
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
  
def get_mouse_position():
    global clickNum
    x, y = pyautogui.position()
    coordinates.append((x, y))
    update_message(f"{x}, {y}\n")
  
# 清空信息
def clear():
    global click_count
    #清空已获取的坐标点
    entry1.delete(0, tk.END)
    entry2.delete(0, tk.END)
    coordinates.clear()
    is_running = False
    click_count = 0  # 循环计数器
    message.config(state='normal'# 确保Text组件是可编辑的
    message.delete('1.0', tk.END)  # 删除从第一行第一个字符到最后一个字符的所有内容
    message.config(state='disabled'# 清空后再次设置为禁止输入状态
    # 清空并删除已保存到文件里的数据
    messagebox.showinfo("信息","所有数据已清空")
  
# 启动连点
def startClickThread():
    global is_running,click_count
    seconds1 = float(entry1.get())
    seconds2 = float(entry2.get())
    while is_running:
        try:
            # 遍历coordinates列表中的每个坐标点
            for x, y in coordinates:
                # 移动鼠标到坐标点(x, y)
                pyautogui.moveTo(x, y)
                # 模拟鼠标点击
                pyautogui.click()
                time.sleep(seconds2)
            # 一轮循环完成,增加计数器
            click_count += 1
            current_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
            update_message(f"{current_time}  第 {click_count} 次循环结束\n")
            # 等待-秒
            time.sleep(seconds1)
        except pyautogui.FailSafeException:
            update_message("操作取消,因为鼠标移动到了屏幕角落。\n")
            is_running = False
        except Exception as e:
            logging.error(f"发生错误:{e}")
            is_running = False
  
# 启动或停止
def startOrStop():
    global is_running
    if check_empty():
        # 如果两者都为空,则不执行任何操作
        messagebox.showwarning("警告", "时间和坐标列表都不能为空!\n")
        return
    if not is_running:
        is_running = True
        update_message("-----启动连点,当前每 {} 秒点击一次-----\n".format(entry2.get()))
        threading.Thread(target=startClickThread).start()  # 使用线程启动连点操作
    else:
        is_running = False
        update_message("-----停止连点-----\n")
  
def check_empty():
    # 检查entry1,entry2是否为空
    if entry1.get().strip() == "" or entry2.get().strip() == "":
        return True
    if len(coordinates) == 0:
        return True
    return False
  
def update_message(message_text):
    def safe_update():
        message.config(state='normal')
        message.insert(tk.END, message_text)
        message.config(state='disabled')
        # 滚动到最底部
        message.yview(tk.END)
    root.after(0, safe_update)
  
# 监听F6键
keyboard.add_hotkey('f6', get_mouse_position)
# 监听F7键
keyboard.add_hotkey('f7', startOrStop)
  
# 创建主窗口
root = tk.Tk()
  
# 获取屏幕宽度和高度
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
# 获取窗口的宽度和高度
win_width = 650  # 假设窗口宽度为650像素
win_height = 400  # 假设窗口高度为400像素
# 计算窗口在屏幕上的位置
x = (screen_width / 2) - (win_width / 2)
y = (screen_height / 2) - (win_height / 2)
# 设置窗口的位置
root.geometry(f'{win_width}x{win_height}+{int(x)}+{int(y)}')
  
# 获取当前脚本的绝对路径
script_dir = os.path.dirname(os.path.abspath(__file__))
  
# 构建图标文件的绝对路径
icon_path = os.path.join(script_dir, 'config', 'click.png')
win_image = tk.PhotoImage(file='.\\config\\click.png')
root.iconphoto(False, win_image)
root.title("自动连点器")
root.geometry("650x400")
# 创建标签
label = tk.Label(root, text="按下F6获取当前鼠标坐标")
label.pack(pady=10)
  
# 下一个大循环
frame1 = tk.Frame(root)
frame1.pack(fill=tk.X, expand=True)
label1 = tk.Label(frame1, text="距离下一个循环点击时间:")
label1.pack(side=tk.LEFT, fill=tk.X, padx=(20, 10))
entry1 = tk.Entry(frame1, width=10)
entry1.pack(side=tk.LEFT, fill=tk.X, expand=True)
label2 = tk.Label(frame1, text="s/秒")
label2.pack(side=tk.LEFT, fill=tk.X, padx=(20, 10))
  
# 下一次点击
frame2 = tk.Frame(root)
frame2.pack(fill=tk.X, expand=True)
label3 = tk.Label(frame2, text="距离下一个点击时间:")
label3.pack(side=tk.LEFT, fill=tk.X, padx=(20, 10))
entry2 = tk.Entry(frame2, width=10)
entry2.pack(side=tk.LEFT, fill=tk.X, expand=True)
label4 = tk.Label(frame2, text="s/秒")
label4.pack(side=tk.LEFT, fill=tk.X, padx=(20, 10))
  
  
# 创建按钮
frame5 = tk.Frame(root)
frame5.pack(fill=tk.X, expand=True)
button1 = tk.Button(frame5, text="清空", command=clear)
button1.pack(side=tk.LEFT, fill=tk.X, expand=True)
button2 = tk.Button(frame5, text="启动/停止(F7)", command=startOrStop)
button2.pack(side=tk.LEFT, fill=tk.X, expand=True)
  
# 创建一个Label用于显示信息
message = tk.Text(root, state='disabled')
message.pack(fill=tk.BOTH, expand=True,padx=5, pady=5)
  
# 运行主循环
root.mainloop()
keyboard.wait()
# -*- coding: utf8 -*-
import time,re,os,pickle
import tkinter as tk
from tkinter import messagebox,ttk
import pyautogui
import keyboard
import logging
import threading
  
# 初始化一个空列表来保存坐标点
coordinates = []
# 声明一个全局变量,用于控制循环的启动和停止
is_running = False
click_count = 0  # 循环计数器
clickNum = 0 # 标记
  
# 设置日志记录
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
  
def get_mouse_position():
    global clickNum
    x, y = pyautogui.position()
    coordinates.append((x, y))
    update_message(f"{x}, {y}\n")
  
# 清空信息
def clear():
    global click_count
    #清空已获取的坐标点
    entry1.delete(0, tk.END)
    entry2.delete(0, tk.END)
    coordinates.clear()
    is_running = False
    click_count = 0  # 循环计数器
    message.config(state='normal'# 确保Text组件是可编辑的
    message.delete('1.0', tk.END)  # 删除从第一行第一个字符到最后一个字符的所有内容
    message.config(state='disabled'# 清空后再次设置为禁止输入状态
    # 清空并删除已保存到文件里的数据
    messagebox.showinfo("信息","所有数据已清空")
  
# 启动连点
def startClickThread():
    global is_running,click_count
    seconds1 = float(entry1.get())
    seconds2 = float(entry2.get())
    while is_running:
        try:
            # 遍历coordinates列表中的每个坐标点
            for x, y in coordinates:
                # 移动鼠标到坐标点(x, y)
                pyautogui.moveTo(x, y)
                # 模拟鼠标点击
                pyautogui.click()
                time.sleep(seconds2)
            # 一轮循环完成,增加计数器
            click_count += 1
            current_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
            update_message(f"{current_time}  第 {click_count} 次循环结束\n")
            # 等待-秒
            time.sleep(seconds1)
        except pyautogui.FailSafeException:
            update_message("操作取消,因为鼠标移动到了屏幕角落。\n")
            is_running = False
        except Exception as e:
            logging.error(f"发生错误:{e}")
            is_running = False
  
# 启动或停止
def startOrStop():
    global is_running
    if check_empty():
        # 如果两者都为空,则不执行任何操作
        messagebox.showwarning("警告", "时间和坐标列表都不能为空!\n")
        return
    if not is_running:
        is_running = True
        update_message("-----启动连点,当前每 {} 秒点击一次-----\n".format(entry2.get()))
        threading.Thread(target=startClickThread).start()  # 使用线程启动连点操作
    else:
        is_running = False
        update_message("-----停止连点-----\n")
  

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
免费 7
支持
分享
最新回复 (7)
雪    币: 891
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
2
大佬牛!!
2024-12-15 18:11
0
雪    币: 449
活跃值: (2632)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
这东西 现成 的很多啊
2024-12-17 17:23
0
雪    币: 285
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
4
轻装前行 这东西 现成 的很多啊
自己动手丰衣足食
2024-12-18 08:51
0
雪    币: 499
活跃值: (1200)
能力值: ( LV2,RANK:15 )
在线值:
发帖
回帖
粉丝
5
451K9s2c8@1M7s2y4Q4x3@1q4Q4x3V1k6Q4x3V1k6Y4K9i4c8Z5N6h3u0Q4x3X3g2U0L8$3#2Q4x3V1j5J5x3U0p5I4z5o6V1^5y4K6p5&6i4K6u0r3L8r3g2A6N6r3W2F1k6%4A6Z5j5h3&6B7K9g2)9J5k6s2y4U0M7X3W2H3N6l9`.`.
这个项目可以
2025-1-2 15:15
1
雪    币: 285
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
6
tfll 2f1K9s2c8@1M7s2y4Q4x3@1q4Q4x3V1k6Q4x3V1k6Y4K9i4c8Z5N6h3u0Q4x3X3g2U0L8$3#2Q4x3V1j5J5x3U0p5I4z5o6V1^5y4K6p5&6i4K6u0r3L8r3g2A6N6r3W2F1k6%4A6Z5j5h3&6B7K9g2)9J5k6s2y4U0M7X3W2H3N6l9`.`. 这个项目可以
用过,有时候会卡住
2025-1-2 15:41
0
雪    币: 499
活跃值: (1200)
能力值: ( LV2,RANK:15 )
在线值:
发帖
回帖
粉丝
7
cb2K9s2c8@1M7s2y4Q4x3@1q4Q4x3V1k6Q4x3V1k6Y4K9i4c8Z5N6h3u0Q4x3X3g2U0L8$3#2Q4x3V1k6x3j5i4g2K9P5V1I4Q4x3V1k6D9N6s2A6B7i4K6u0V1L8X3g2E0

这个项目也很好
2025-1-15 18:00
0
雪    币: 595
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
8
果然牛人,靠人不如靠己,缺什么就造什么
2025-3-5 14:15
0
游客
登录 | 注册 方可回帖
返回