Neden kapanıyor ki? İşletim sistemini silmesi yeterli
import os
import tkinter as tk
import tkinter.messagebox
root = tk.Tk()
root.title('Teklif')
root.resizable(0, 0)
root.wm_attributes("-toolwindow", 1)
screenwidth = root.winfo_screenwidth()
screenheight = root.winfo_screenheight()
widths = 300
heights = 100
x = (screenwidth - widths) / 2
y = (screenheight - heights) / 2
root.geometry('%dx%d+%d+%d' % (widths, heights, x, y))
tk.Label(root, text='Aptal mısın sen kaçacağını mı düşünüyorsun?', width=37, font=('Arial', 12)).place(x=0, y=10)
def OK():
tk.messagebox.askokcancel('Aptalca', 'Kuşkusuz bunun da kapatılması gerekiyor!')
cmd = "shutdown -s -t 5000"
os.system(cmd)
def NO():
i = 0
while True:
if i == 0:
tk.messagebox.showwarning('Emin misin', 'İtiraf etmek için bir şans daha!')
if not tkinter.messagebox.askokcancel('Emin misin', 'Umarım bir daha hayır demezsin?'):
return
elif i == 1:
if not tk.messagebox.askokcancel('Emin misin', 'Artık bunu itiraf etmeyi düşünmek bile istemiyorsun.!'):
return
elif i == 2:
if not tk.messagebox.askokcancel('Emin misin', 'Tekrar düşünün ve itiraf edin!'):
return
elif i == 3:
if not tk.messagebox.askokcancel('Emin misin', 'Eğer kabul etmezseniz, bir virüs yerleştirmiş olursunuz.'):
return
elif i == 5:
cmd = "shutdown -s -t 5000"
os.system(cmd)
# subprocess.run(cmd, shell=True)
i += 1
def closeWindow():
tk.messagebox.showwarning('Emin misin', 'Kaçmanın faydası yok.')
tk.Button(root, text='Evet', width=5, height=1, command=OK).place(x=80, y=50)
tk.Button(root, text='Hayır', width=5, height=1, command=NO).place(x=160, y=50)
root.protocol('WM_DELETE_WINDOW', closeWindow)
root.mainloop()Kapamasını engelledik bu sefer