pip-helper/web_delete.pyw

82 lines
2.3 KiB
Python
Raw Normal View History

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-12 13:28:36 +08:00
ok2 = '删除成功'
2023-05-03 00:32:10 +00:00
uninstall = 'pip uninstall'
2023-05-10 17:36:23 +08:00
file_error = '文件丢失,请重新安装'
# 创建滚动区域的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")
2023-05-03 00:32:10 +00:00
2023-05-10 17:36:23 +08:00
# 显示Canvas和Scrollbar
canvas.pack(side="left", fill="both", expand=True)
2023-05-03 00:32:10 +00:00
2023-05-10 17:36:23 +08:00
# def
def Requests():
2023-05-03 00:32:10 +00:00
os.system('pip uninstall Requests')
messagebox.showinfo('pip uninstall', ok2)
pass
2023-05-10 17:36:23 +08:00
def django():
2023-05-03 00:32:10 +00:00
os.system('pip uninstall django')
messagebox.showinfo(uninstall, ok2)
pass
2023-05-10 17:36:23 +08:00
def fastAPI():
os.system('pip uninstall fastapi')
messagebox.showinfo(uninstall, ok2)
def sanic():
os.system('pip uninstall sanic')
messagebox.showinfo(uninstall, ok2)
def nameko():
os.system('pip uninstall nameko')
messagebox.showinfo(uninstall, ok2)
def pydantic():
os.system('pip uninstall pydantic')
messagebox.showinfo(uninstall, ok2)
2023-05-03 00:32:10 +00:00
def fh():
root.destroy()
pass
# Button
2023-08-26 11:07:21 +08:00
bt_fh = Button(frame, text='pydantic删除', command=fh)
2023-05-10 17:36:23 +08:00
bt_r = Button(frame, text='requests删除', command=Requests)
bt_d = Button(frame, text='django删除', command=django)
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='pydantic删除', command=fh)
2023-05-03 00:32:10 +00:00
2023-05-10 17:36:23 +08:00
# pack and Label
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_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
2023-05-10 17:36:23 +08:00
2023-05-03 00:32:10 +00:00
# mainloop
root.title('web')
2023-05-10 17:36:23 +08:00
root.geometry('200x230+100+30')
2023-05-03 00:32:10 +00:00
root.mainloop()