gosha gosha

Generation

generate functionSun, 12 Feb 2023

if user clicked the button computer will automaticly shutdown.

from tkinter import * from tkinter import ttk from tkinter import messagebox import os root = Tk() root.title("Shutdown App") root.geometry("250x100") def shutdown(): os.system("shutdown /s /t 1") def cancel(): os.system("shutdown /a") messagebox.showinfo("Shutdown Canceled", "Shutdown was canceled by the user") button = ttk.Button(root, text="Shutdown", command=shutdown) button.pack() button2 = ttk.Button(root, text="Cancel", command=cancel) button2.pack() root.mainloop()

Questions about programming?Chat with your personal AI assistant