Loading... # 引言 话不多说,我上班才没有摸鱼 ![image.png](https://www.zunmx.top/usr/uploads/2022/06/3955758901.png) # 代码 ```python import win32api import win32con import time import tkinter as tk import threading import os def fun1(event): os._exit(0) def fun2(): win = tk.Tk() win.overrideredirect(True) win.attributes("-topmost", 1) win.geometry("5x5") win.configure(bg='yellow') win.bind("<B3-Motion>", fun1) # 右键滑动事件? win.mainloop() def fun3(): time.sleep(1) while True: x, y = win32api.GetCursorPos() win32api.SetCursorPos([1, 1]) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0) win32api.SetCursorPos([x, y]) print("Active Once") time.sleep(30) threading.Thread(target=fun2, args=()).start() threading.Thread(target=fun3, args=()).start() ``` # 原理 1. 定时鼠标移动 2. 创建空白窗体 3. 定时点击空白窗体 4. 鼠标指针位置恢复到原来位置 # 结语 当你有需求并且没有满足你需求的产品时,动手做起来。 Craft The World © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 1 如果觉得我的文章对你有用,请随意赞赏