简书链接:python已停止工作的窗口总是弹出解决办法
文章字数:83,阅读全文大约需要1分钟
每次关闭窗口就给我弹,烦死了。

![XH]0VFPC34]$(9ZA@}$V{YE.png](https://upload-images.jianshu.io/upload_images/2815884-d6cafd4524bad6f0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

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
from tkinter import *
import os
import atexit

from tkinter import messagebox
from win32com.shell import shell,shellcon

def taskkill_this():
# kill this process
current_pid = os.getpid()
print("kill")
os.system("taskkill /pid %s /f" % current_pid)

# v1 = conf.getint('baseconfig', 'v1')
root = Tk()
root.title("键盘资源处理工具") # 窗口标题
frame=Frame(root)
frame.grid(row=0, columnspan=3)

label = Label(frame, text="<<-----------键盘资源替换工具----------->>")
label.grid(row=0, columnspan=3)

atexit.register(taskkill_this)

root.mainloop()