from Tkinter import * import threading import os import tkMessageBox def helpitem(): tkMessageBox.showinfo(title='How to Use', message='How to use - Click on one of the buttons and your computer will shutdown in that amount of time plus 1 minute.\n\n To cancel shutdown - The only way to cancel it is when the last minute of the timer when a window on your computer pops up that says you have one minute until shutdown. Once that pops, on Windows, go to start menu and click Run, then type shutdown -a and the window that says your computer will shutdown in one minute should go away.\n\n What happens if I click more than one button? All the buttons that you clicked will have their timer started, therefore the one with the least amount of time will shutdown your computer unless cancelled, all of the timers you started will go off, you will have to cancel each one individually.\n\n You may close the program after you click a button and it will still shutdown.') def creditsitem(): tkMessageBox.showinfo(title='Credits', message='Program written by Caleb Arnold using Python and Tkinter.\n\n ShutdownTimer1.0 is realeased as freeware, if you know anyone trying to resell or profit from this product please report them to me at ace24ace12@yahoo.com. Also use this email address if you have any questions or would like to report a bug. Thanks to all the people who helped get me through the coding process. Hope you enjoy and find this program useful.') root = Tk() root.title('ShutdownTimer1.0') menu = Menu(root) root.config(menu=menu) filemenu = Menu(menu) menu.add_cascade(label="Menu", menu=filemenu) filemenu.add_command(label="How to use", command=helpitem) filemenu.add_command(label="Credits", command=creditsitem) def thirtymin(): os.system('shutdown -s -t 60') def hourmin(): os.system('shutdown -s -t 60') def secbut(): os.system('shutdown -s -t 60') def hourhalf(): os.system('shutdown -s -t 60') def hourdouble(): os.system('shutdown -s -t 60') def twohalfhour(): os.system('shutdown -s -t 60') def threehours(): os.system('shutdown -s -t 60') def eighthours(): os.system('shutdown -s -t 60') def fivehours(): os.system('shutdown -s -t 60') def oneday(): os.system('shutdown -s -t 60') def start_a(): a = threading.Timer(1800.0, thirtymin) a.start() def start_b(): b = threading.Timer(3600.0, hourmin) b.start() def start_c(): c = threading.Timer(10.0, secbut) c.start() def start_d(): d = threading.Timer(5400.0, hourhalf) d.start() def start_e(): e = threading.Timer(7200.0, hourdouble) e.start() def start_f(): f = threading.Timer(9000.0, twohalfhour) f.start() def start_h(): h = threading.Timer(10800.0, threehours) h.start() def start_one(): one = threading.Timer(28800.0, eighthours) one.start() def start_two(): two = threading.Timer(54000.0, fivehours) two.start() def start_three(): three = threading.TImer(86400.0, oneday) three.start() thirty = Button(root, text='30 minutes', width=18, command = start_a) hour = Button(root, text='1 Hour', width=18, command = start_b) tensec = Button(root, text='10 Seconds', width=18, command = start_c) hourthirty = Button(root, text='1.5 Hours', width=18, command = start_d) twohour = Button(root, text='2 Hours', width=18, command = start_e) twohalf = Button(root, text='2.5 Hours', width=18, command = start_f) threehour = Button(root, text='3 Hours', width=18, command = start_h) eighthour = Button(root, text='8 Hours', width=18, command = start_one) fivehour = Button(root, text='15 Hours', width=18, command = start_two) fullday = Button(root, text='24 Hours', width=18, command = start_three) marker = Label(root, text='-------------------------------------') markertwo = Label(root, text='-------------------------------------') tensec.pack(anchor=NW) markertwo.pack(anchor=NW) thirty.pack(anchor=NW) hour.pack(anchor=NW) hourthirty.pack(anchor=NW) twohour.pack(anchor=NW) twohalf.pack(anchor=NW) threehour.pack(anchor=NW) marker.pack(anchor=NW) eighthour.pack(anchor=NW) fivehour.pack(anchor=NW) fullday.pack(anchor=NW) root.mainloop()