不出意外的话使用这个软件cursor可以嫖一生,推荐使用cursorfree的启动cursor创建项目,不要用官方原版新版。
三联私信留言666可以免费获取(不定时回复私信)
或xoxome.online自主获取
TIPS

cursorfree的python开发代码演示用于csdn

软件使用过程

cursor一站式无限白嫖|解决50次150次限制|解决自动升级问题|

软件开发代码如下,一共一个cursorfree.py

import tkinter as tk
from tkinter import ttk
import subprocess
import os
from database import get_announcement, get_version_info, check_usage_limit
from tkinter import messagebox
import webbrowser
from tkhtmlview import HTMLLabel
import threading
import queue
import sys
import locale
import psutil  # 添加此导入

class CursorFreeApp:
    def __init__(self, root):
        # 设置默认编码和语言环境
        if sys.platform.startswith('win'):
            locale.setlocale(locale.LC_ALL, 'C')
        
        self.root = root
        self.root.title("CursorFree 1.0")
        self.root.geometry("800x600")
        
        # 获取程序运行路径
        if getattr(sys, 'frozen', False):
            self.application_path = sys._MEIPASS
        else:
            self.application_path = os.path.dirname(os.path.abspath(__file__))
        
        self.current_version = "1.0"  # 当前版本号
        self.buttons_enabled = True  # 按钮状态标志
        
        self.setup_ui()
        self.setup_queue()
        
    def setup_ui(self):
        # 创建主框架
        main_frame = ttk.Frame(self.root, padding="10")
        main_frame.pack(fill=tk.BOTH, expand=True)
        
        # 创建按钮框架
        button_frame = ttk.Frame(main_frame)
        button_frame.pack(pady=20)
        
        # 创建终结Cursor进程按钮
        ttk.Button(
            button_frame, 
            text="终结Cursor进程", 
            command=self.kill_cursor_processes
        ).pack(side=tk.LEFT, padx=10)
        
        # 存储按钮引用
        self.cursor_btn = ttk.Button(
            button_frame, 
            text="启动Cursor", 
            command=self.run_cursor
        )
        self.cursor_btn.pack(side=tk.LEFT, padx=10)
        
        self.relive_btn = ttk.Button(
            button_frame, 
            text="Cursor重生V1.2", 
            command=self.run_cursor_relive
        )
        self.relive_btn.pack(side=tk.LEFT, padx=10)
        
        # 创建输出框架
        output_frame = ttk.LabelFrame(main_frame, text="运行输出", padding="10")
        output_frame.pack(fill=tk.BOTH, expand=True, pady=10)
        
        # 创建输出文本框
        self.output_text = tk.Text(output_frame, height=6, wrap=tk.WORD)
        self.output_text.pack(fill=tk.BOTH, expand=True)
        
        # 创建公告区域
        announcement_frame = ttk.LabelFrame(main_frame, text="公告", padding="10")
        announcement_frame.pack(fill=tk.BOTH, expand=True, pady=10)
        
        # 使用HTMLLabel显示公告内容
        self.announcement_label = HTMLLabel(announcement_frame, html="<p>加载中...</p>")
        self.announcement_label.pack(fill=tk.BOTH, expand=True)
        
        # 异步加载公告
        threading.Thread(target=self.load_announcement, daemon=True).start()
        
        # 检查版本
        self.check_version()
    
    def setup_queue(self):
        self.msg_queue = queue.Queue()
        self.update_output()
    
    def get_exe_path(self, exe_name):
        """获取exe文件的完整路径"""
        if getattr(sys, 'frozen', False):
            return os.path.join(self.application_path, "_tk_data_", exe_name)
        return os.path.join("_tk_data_", exe_name)
    
    def run_cursor(self):
        if not self.buttons_enabled:
            messagebox.showwarning("警告", "请先更新到最新版本!")
            return
        
        try:
            exe_path = self.get_exe_path("4.exe")
            if os.path.exists(exe_path):
                startupinfo = subprocess.STARTUPINFO()
                startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
                subprocess.Popen(exe_path, startupinfo=startupinfo)
            else:
                messagebox.showerror("错误", "找不到4.exe文件")
        except Exception as e:
            messagebox.showerror("错误", f"运行失败: {str(e)}")
    
    def run_cursor_relive(self):
        if not self.buttons_enabled:
            messagebox.showwarning("警告", "请先更新到最新版本!")
            return
        
        # 只在使用重生功能时检查使用次数限制
        can_use, message = check_usage_limit()
        if not can_use:
            messagebox.showwarning("警告", message)
            return
        
        try:
            exe_path = self.get_exe_path("relive1.2.exe")
            if os.path.exists(exe_path):
                self.run_process_with_output(exe_path)
                messagebox.showinfo("提示", message)  # 显示剩余次数
            else:
                messagebox.showerror("错误", "找不到relive1.2.exe文件")
        except Exception as e:
            messagebox.showerror("错误", f"运行失败: {str(e)}")
    
    def update_output(self):
        """更新输出文本框的内容"""
        try:
            while True:
                msg = self.msg_queue.get_nowait()
                self.output_text.insert(tk.END, msg)
                self.output_text.see(tk.END)
        except queue.Empty:
            pass
        finally:
            self.root.after(100, self.update_output)
    
    def run_process_with_output(self, exe_path):
        """在单独的线程中运行进程并捕获输出"""
        def run():
            try:
                self.output_text.delete('1.0', tk.END)
                self.msg_queue.put(f"正在运行 {os.path.basename(exe_path)}...\n")
                
                startupinfo = subprocess.STARTUPINFO()
                startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
                
                process = subprocess.Popen(
                    exe_path,
                    stdout=subprocess.PIPE,
                    stderr=subprocess.STDOUT,
                    stdin=subprocess.PIPE,  # 添加标准输入
                    universal_newlines=True,
                    bufsize=1,
                    encoding='gbk',  # 使用GBK编码处理中文
                    startupinfo=startupinfo
                )
                
                # 读取输出
                while True:
                    line = process.stdout.readline()
                    if line == '' and process.poll() is not None:
                        break
                    if line:
                        self.msg_queue.put(line)
                        
                    # 如果检测到等待输入的提示,自动发送回车
                    if "按回车键退出" in line:
                        process.stdin.write('\n')
                        process.stdin.flush()
                
                # 获取返回码
                return_code = process.wait()
                
                if return_code == 0:
                    self.msg_queue.put("\n✨ 运行完成!\n")
                    # 在主线程显示完成消息
                    self.root.after(0, lambda: messagebox.showinfo(
                        "运行成功",
                        "✨ Cursor重生运行完毕!\n祝您使用愉快!",
                        parent=self.root
                    ))
                else:
                    self.msg_queue.put(f"\n⚠️ 程序返回错误代码: {return_code}\n")
                
            except Exception as e:
                self.msg_queue.put(f"\n错误: {str(e)}\n")
            
        thread = threading.Thread(target=run, daemon=True)
        thread.start()
    
    def load_announcement(self):
        try:
            announcement = get_announcement()
            if announcement:
                # 确保公告内容是HTML格式
                if not announcement.strip().startswith('<'):
                    announcement = f"""
                    <html>
                    <head>
                        <meta charset="utf-8">
                    </head>
                    <body>
                        <div style='font-family: Microsoft YaHei, Arial, sans-serif; padding: 15px;'>
                            <p style='line-height: 1.5;'>{announcement}</p>
                        </div>
                    </body>
                    </html>
                    """
                # 使用 after 方法在主线程中更新 GUI
                self.root.after(0, lambda: self.announcement_label.set_html(announcement))
            else:
                self.root.after(0, lambda: self.announcement_label.set_html("""
                    <html>
                    <head>
                        <meta charset="utf-8">
                    </head>
                    <body>
                        <p style='color: #666; font-family: Microsoft YaHei;'>暂无公告</p>
                    </body>
                    </html>
                """))
        except Exception as e:
            error_html = f"""
                <html>
                <head>
                    <meta charset="utf-8">
                </head>
                <body>
                    <p style='color: red; font-family: Microsoft YaHei;'>加载公告失败: {str(e)}</p>
                </body>
                </html>
            """
            self.root.after(0, lambda: self.announcement_label.set_html(error_html))
    
    def kill_cursor_processes(self):
        """终结所有包含cursor字样的进程"""
        killed = False
        for proc in psutil.process_iter(['pid', 'name']):
            try:
                # 同时检查 cursor 和 CursorFree
                if 'cursor' in proc.info['name'].lower() or 'cursorfree' in proc.info['name'].lower():
                    proc.kill()
                    killed = True
            except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
                continue
        
        if killed:
            messagebox.showinfo("成功", "已终结所有Cursor相关进程!")
        else:
            messagebox.showinfo("提示", "未发现正在运行的Cursor进程。")
    
    def check_version(self):
        """检查版本并处理强制更新"""
        version_info = get_version_info()
        if version_info is None:
            return
        
        if version_info['version'] != self.current_version:
            message = "发现新版本!"
            if version_info['force_update']:
                message += "\n当前版本已停用,请立即更新。"
                self.disable_buttons()
            
            if messagebox.showwarning("版本更新", message + "请下载最新版本。"):
                if version_info['update_url']:
                    webbrowser.open(version_info['update_url'])
    
    def disable_buttons(self):
        """禁用所有操作按钮"""
        self.buttons_enabled = False
        self.cursor_btn.configure(state='disabled')
        self.relive_btn.configure(state='disabled')

def main():
    # 设置高DPI支持
    try:
        from ctypes import windll
        windll.shcore.SetProcessDpiAwareness(1)
    except:
        pass
    
    root = tk.Tk()
    app = CursorFreeApp(root)
    root.mainloop()

if __name__ == "__main__":
    main() 
Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐