2023-05-03 00:32:10 +00:00
|
|
|
|
from tkinter import *
|
|
|
|
|
from tkinter import messagebox
|
|
|
|
|
import os
|
|
|
|
|
|
2023-05-10 17:36:23 +08:00
|
|
|
|
# 定义内容和创建主窗口
|
2023-05-03 00:32:10 +00:00
|
|
|
|
root = Tk()
|
|
|
|
|
ml = os.getcwd()
|
2023-05-10 17:36:23 +08:00
|
|
|
|
ok = '安装成功'
|
|
|
|
|
install = 'pip install'
|
2023-05-03 00:32:10 +00:00
|
|
|
|
file_error = '文件丢失,请重新安装'
|
|
|
|
|
|
|
|
|
|
|
2023-05-10 17:36:23 +08:00
|
|
|
|
# 创建滚动区域的Canvas对象
|
|
|
|
|
canvas = Canvas(root, width=280, height=280, scrollregion=(0, 0, 500, 500))
|
|
|
|
|
|
|
|
|
|
# 创建可滚动区域的Frame对象,并将其添加到Canvas中
|
|
|
|
|
frame = Frame(canvas)
|
|
|
|
|
frame.bind("<Configure>", lambda e: canvas.configure(scrollregion=canvas.bbox("all")))
|
|
|
|
|
canvas.create_window((0, 0), window=frame, anchor="nw")
|
|
|
|
|
|
|
|
|
|
# 创建Scrollbar对象,并将其绑定到Canvas上
|
|
|
|
|
scrollbar = Scrollbar(root, orient="vertical", command=canvas.yview)
|
|
|
|
|
canvas.configure(yscrollcommand=scrollbar.set)
|
|
|
|
|
scrollbar.pack(side="right", fill="y")
|
|
|
|
|
|
|
|
|
|
# 显示Canvas和Scrollbar
|
|
|
|
|
canvas.pack(side="left", fill="both", expand=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# def
|
2023-05-03 00:32:10 +00:00
|
|
|
|
def Requests():
|
2023-05-11 22:03:12 +08:00
|
|
|
|
os.system('pip install Requests -i https://mirrors.aliyun.com/pypi/simple/')
|
2023-05-03 00:32:10 +00:00
|
|
|
|
messagebox.showinfo('pip install', ok)
|
|
|
|
|
pass
|
|
|
|
|
def django():
|
2023-05-11 22:03:12 +08:00
|
|
|
|
os.system('pip install django -i https://mirrors.aliyun.com/pypi/simple/')
|
2023-05-10 17:36:23 +08:00
|
|
|
|
messagebox.showinfo(install, ok)
|
2023-05-03 00:32:10 +00:00
|
|
|
|
pass
|
|
|
|
|
def open_exe(exe_name):
|
|
|
|
|
if os.path.exists(os.path.join(ml, f"{exe_name}.exe")):
|
|
|
|
|
os.system(f"start {exe_name}.exe")
|
|
|
|
|
else:
|
|
|
|
|
messagebox.showerror('install', file_error)
|
|
|
|
|
pass
|
|
|
|
|
pass
|
2023-05-10 17:36:23 +08:00
|
|
|
|
def fastAPI():
|
2023-05-11 22:03:12 +08:00
|
|
|
|
os.system('pip install fastapi -i https://mirrors.aliyun.com/pypi/simple/')
|
2023-05-10 17:36:23 +08:00
|
|
|
|
messagebox.showinfo(install, ok)
|
|
|
|
|
def sanic():
|
2023-05-11 22:03:12 +08:00
|
|
|
|
os.system('pip install sanic -i https://mirrors.aliyun.com/pypi/simple/')
|
2023-05-10 17:36:23 +08:00
|
|
|
|
messagebox.showinfo(install, ok)
|
|
|
|
|
def nameko():
|
2023-05-11 22:03:12 +08:00
|
|
|
|
os.system('pip install nameko -i https://mirrors.aliyun.com/pypi/simple/')
|
2023-05-10 17:36:23 +08:00
|
|
|
|
messagebox.showinfo(install, ok)
|
|
|
|
|
def pydantic():
|
2023-05-11 22:03:12 +08:00
|
|
|
|
os.system('pip install pydantic -i https://mirrors.aliyun.com/pypi/simple/')
|
2023-05-10 17:36:23 +08:00
|
|
|
|
messagebox.showinfo(install, ok)
|
2023-05-06 13:26:10 +08:00
|
|
|
|
def fh():
|
|
|
|
|
root.destroy()
|
2023-05-03 00:32:10 +00:00
|
|
|
|
|
|
|
|
|
|
2023-05-10 17:36:23 +08:00
|
|
|
|
# Button
|
|
|
|
|
bt_d = Button(frame, text='django安装', command=django)
|
|
|
|
|
bt_r = Button(frame, text='Requests安装', command=Requests)
|
|
|
|
|
bt_fastapi = Button(frame, text='fastAPI删除', command=fastAPI)
|
|
|
|
|
bt_sanic = Button(frame, text='sanic删除', command=sanic)
|
|
|
|
|
bt_nameko = Button(frame, text='namekos删除', command=nameko)
|
|
|
|
|
bt_pydantic = Button(frame, text='pydantic删除', command=pydantic)
|
|
|
|
|
bt_fh = Button(frame, text='返回', command=fh)
|
2023-05-03 00:32:10 +00:00
|
|
|
|
|
2023-05-10 17:36:23 +08:00
|
|
|
|
# pack
|
2023-05-03 00:32:10 +00:00
|
|
|
|
Label(root, text='web类安装').pack()
|
2023-07-25 23:59:27 +08:00
|
|
|
|
bt_fh.pack()
|
2023-05-03 00:32:10 +00:00
|
|
|
|
bt_d.pack()
|
|
|
|
|
bt_r.pack()
|
2023-05-10 17:36:23 +08:00
|
|
|
|
bt_d.pack()
|
|
|
|
|
bt_r.pack()
|
|
|
|
|
bt_fastapi.pack()
|
|
|
|
|
bt_sanic.pack()
|
|
|
|
|
bt_nameko.pack()
|
|
|
|
|
bt_pydantic.pack()
|
2023-07-25 23:59:27 +08:00
|
|
|
|
|
2023-05-03 00:32:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# mainloop
|
|
|
|
|
root.title('web')
|
2023-05-10 17:36:23 +08:00
|
|
|
|
root.geometry('200x250+600+400')
|
2023-05-03 00:32:10 +00:00
|
|
|
|
root.mainloop()
|