Im writing a fake virus pop-up window. I want it so that, you can only press the close button (which by default is DISABLED) if you have checked the box saying "I acknowledge the message above". I've tried nearly everything. Thanks in advance -
import tkinter as tk
from tkinter import *
window = tk.Tk()
window.eval('tk::PlaceWindow . center')
w = tk.Label(window, pady=30, text="MacOS has detected malicious malware.\nPlease turn off your computer immediately")
e = tk.Label(window, text="Ignoration of this message may\n result in further damage.").place(x=70, y=80)
b = tk.Label(window, font=("", 9), fg="gray", text="Apple Inc © Designed in California").place(x=95, y=220)
a = tk.Label(window, text="I acknowledge the message above").place(x=75, y=130)
w.pack()
btn = Button(window, text='Ok', width=10,
height=1, bd='10', command=window.destroy, state=DISABLED)
btn.place(x=125, y=170)
var = IntVar()
c = Checkbutton(window, variable=var, onvalue="On", offvalue="Off").place(x=50, y=130)
window.title("Warning!")
window.geometry("350x250")
window.mainloop()
Aucun commentaire:
Enregistrer un commentaire