1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
   |  import os import subprocess import tkinter from tkinter import messagebox from tkinter import filedialog
 
 
  def close_app():     if messagebox.askokcancel("提示","确定要退出吗?"):         window.destroy()  
 
  def OpenFilePath():     file_path = filedialog.askdirectory()       if file_path:         FilePath.set(file_path)  
  def CheckPath():     path = FilePath.get()          wechat_path = os.path.join(path, "WeChat.exe")     if os.path.exists(wechat_path):         startWechat(path)     else:         messagebox.showinfo("提示:", "请正确设置微信的安装路径")
 
  def startWechat(path):     try:                           cmd = "start WeChat.exe"                           Count_Amount = int(Amount.get())         if Count_Amount < 1:             messagebox.showinfo("提示:","不能小于1,请输入1~6之间的数字")             return                   if Count_Amount > 6:             messagebox.showinfo("提示:","不能大于6,请输入1~6之间的数字")             return          for i in range(0,Count_Amount,1):                          subprocess.Popen(args=cmd, shell=True, cwd=path)              except Exception as e:         messagebox.showerror("提示:", "请输入整数,%s" % e)      window = tkinter.Tk()
  window.title('微信多开')
  window.geometry('400x200+400+200')
  window.resizable(0, 0)
  FilePath = tkinter.StringVar() Amount = tkinter.StringVar()
  FilePath.set(r"C:\Program Files (x86)\Tencent\WeChat") Amount.set(2)
  tkinter.Label(window, text='微信安装位置:', font=('华文行楷', 11)).place(x=10, y=50) tkinter.Label(window, text='(注意:为wechat.exe的路径)', fg="#FF0000", font=('华文行楷', 10)).place(x=110, y=70) tkinter.Entry(window, width=32, textvariable=FilePath, font=('Arial', 9)).place(x=110, y=50) tkinter.Label(window, text='多开微信数量:', font=('华文行楷', 11)).place(x=10, y=103)
  tkinter.Entry(window, width=5, textvariable=Amount, font=('Arial', 10)).place(x=110, y=103)
  Choice_Button = tkinter.Button(window, text='选择', command=OpenFilePath) Choice_Button.place(x=350, y=45) Confirm_Button = tkinter.Button(window, bd=6, width=6, text='确定', command=CheckPath) Confirm_Button.place(x=180, y=150)
  window.protocol("WM_DELETE_WINDOW",close_app) window.mainloop()
 
 
 
 
  |