pip-helper/client.pyw

54 lines
1.4 KiB
Python
Raw Normal View History

2023-04-27 21:56:53 +08:00
from tkinter import *
2023-04-27 22:22:00 +08:00
from tkinter import messagebox
2023-05-12 19:30:07 +08:00
import sys
from subprocess import call
2023-04-27 21:56:53 +08:00
import os
root = Tk()
2023-04-30 14:01:58 +08:00
ml = os.getcwd()
2023-04-27 21:56:53 +08:00
file_error = '文件丢失,请重新安装'
2023-04-30 14:01:58 +08:00
def jc(exe_name):
if os.path.exists(os.path.join(ml,f"{exe_name}.exe")):
os.system(f"start {exe_name}.exe")
2023-04-27 21:56:53 +08:00
else:
2023-04-30 14:01:58 +08:00
messagebox.showerror('system',file_error)
pass
2023-05-12 19:30:07 +08:00
def update_pip():
# 获取Python安装路径
python_path = sys.executable
# 使用subprocess模块调用pip进行更新
call([python_path, '-m', 'pip', 'install', '--upgrade', 'pip'])
messagebox.showinfo('pip helper','更新pip包管理器成功!')
2023-04-30 14:01:58 +08:00
def install():
jc("install")
2023-04-27 21:56:53 +08:00
2023-04-30 14:01:58 +08:00
def delete():
jc("delete")
2023-04-27 21:56:53 +08:00
def update():
2023-04-30 14:01:58 +08:00
jc("update")
2023-04-27 21:56:53 +08:00
def exit_exe():
root.destroy()
pass
2023-05-07 17:58:36 +08:00
def eyeryone():
messagebox.showerror('pip helper', '暂时无法使用,因为程序测试途中出现未知问题......')
2023-04-27 21:56:53 +08:00
# Button and Label
2023-04-30 14:01:58 +08:00
Label(root, text='pip_helper').pack()
Button(root, text='安装模式', command=install).pack()
Button(root, text='删除模式', command=delete).pack()
2023-05-07 17:58:36 +08:00
Button(root, text='全部安装或删除', command=eyeryone).pack()
2023-04-27 21:56:53 +08:00
Button(root, text='更新日志', command=update).pack()
Button(root, text='退出', command=exit_exe).pack()
# mainloop
root.title('启动器')
2023-05-07 17:58:36 +08:00
root.geometry('200x220+400+400')
2023-04-27 21:56:53 +08:00
root.mainloop()