请不要下载此程序,会有很大的后果
from tkinter import *
from random import *
class application():
def __init__(self, master):
self.window = master
self.l1 = Label(self.window, text='千万不要点')
self.b1 = Button(self.window, text='这里', command=self.DND)
self.l1.pack()
self.b1.pack()
def DND(self):
tk = Toplevel(self.window)
tk.protocol('WM_DELETE_WINDOW', self.window)
flag = False
for i in range(10):
for j in range(10):
ran = randint(1, 20)
if ran <= 3:
B = Button(tk, text=' ', width=2, command=tk.destroy)
elif ran <= 18:
B = Button(tk, text=' ', width=2, command=self.DND)
else:
B = Button(tk, text=' ', width=2, command=None)
B.grid(row=i, column=j)
if __name__ == '__main__':
root = Tk()
application(root)
root.mainloop()
后果自负