保存参数的功能
创建一个文本文件,用来保存用户输入的参数。例如,创建一个名为config.txt
的文本文件,将其放在与应用程序脚本相同的目录中。
import tkinter as tk
import threading
import random
import time
import os
import pyautogui
from pynput import keyboard
class AutoClickerApp:
def __init__(self, root):
self.root = root
self.root.title("自动点击器")
self.start_button = tk.Button(root, text="开始点击", command=self.start_clicking)
self.stop_button = tk.Button(root, text="停止点击", command=self.stop_clicking)
self.start_button.pack()
self.stop_button.pack()
self.x_min_label = tk.Label(root, text="X轴最小值:")
self.x_max_label = tk.Label(root, text="X轴最大值:")
self.y_min_label = tk.Label(root, text="Y轴最小值:")
self.y_max_label = tk.Label(root, text="Y轴最大值:")
self.min_delay_label = tk.Label(root, text="最小间隔时间 (秒):")
self.max_delay_label = tk.Label(root, text="最大间隔时间 (秒):")
self.x_min_label.pack()
self.x_min_entry = tk.Entry(root)
self.x_min_entry.pack()
self.x_max_label.pack()
self.x_max_entry = tk.Entry(root)
self.x_max_entry.pack()
self.y_min_label.pack()
self.y_min_entry = tk.Entry(root)
self.y_min_entry.pack()
self.y_max_label.pack()