This python program shuts the system down with the minute and hour selected as per the sliders.


Source code::

from tkinter import *
import os
from tkinter import messagebox as tmsg


def run():
    a=slider.get()
    b=slider1.get()
    if b==0:
        tmsg.showinfo("Error","You cannot shutdown with 0 seconds!!!")
    elif a==0:
        c=b*60
        os.system(f"shutdown /s /t {c}")
    elif a>0:
        c=(a*60*60)+(b*60)
        os.system(f"shutdown /s /t {c}")
    else:
        pass
   
def cancel():
    os.system("shutdown /a")

root=Tk()
root.title("Shutdown Gui")
root.geometry("500x190")
root.minsize(500,190)
root.maxsize(1000,190)
f1=Frame(root,bg="#ffffff")
f1.pack(fill="both")
f2=Frame(root,bg='#ffffff')
f2.pack(fill="both")
f4=Frame(root,bg='green')
f4.pack(fill="both")

Label(f1,text="Hours    ",fg="#000000",bg="#ffffff",font='arial 17 bold').pack(side=LEFT)
slider=Scale(f1,from_=0,to=1+11,orient=HORIZONTAL,bg="#ffffff",borderwidth=0)
slider.pack(fill="both")

Label(f2,text="Minutes",fg="#000000",bg="#ffffff",font='arial 17 bold').pack(side=LEFT)
slider1=Scale(f2,from_=0,to=60,orient=HORIZONTAL,tickinterval=10,bg="#ffffff",borderwidth=0)
slider1.pack(fill="both")

Button(f4,text="Run",font="arial 17 bold",fg="#ffffff",bg='green',command=run).pack(fill='x')
Button(f4,text="Cancel",font="arial 17 bold",fg="#ffffff",bg='red',command=cancel).pack(fill='x')

root.mainloop() 





Here is .exe package :::

https://drive.google.com/open?id=1cmtWBWn7KUw-6eL7c5I03yldGLETMpBB 



                          #########################R.D.Gadekar#########################. 
To be connected with me msg on ::: """rameshwarrdg@gmail.com"""
Instagram handle :: """rameshwar_d_g"""

Comments

Post a Comment

Popular Posts