Shutdown, Restart, Logout System Using Python GUI:
We Can Shutdown, Restart, Logout A computer Using Python GUI. Python with tkinter is the fastest and easiest way to create the GUI applications. Creating a GUI using tkinter is an easy task.
Step-1:
importing modules
from tkinter import *
import os
Step-2:
User Define Functions for execute Shutdown, Restart, Logout
def shutdown():
return os. system("shutdown -s -t 1")
def restart():
return os. system("shutdown -r -t 1")
def logout():
return os. system("shutdown -l")
Step-3:
Create tkinter Object and setup geometry
master=Tk()
master. geometry("200x200")
Step-4:
Setting Background to grey
master.c onfigure(bg='light grey')
Step-5:
Creating Buttons
Button(master,text="Shutdown",command=shutdown).place(x=20,y=20)
Button(master,text="Restart",command=restart).place(x=20,y=50)
Button(master,text="Logout",command=logout).place(x=20,y=80)
Step-6:
Execution
$python shutdown.py
Output:
To Download Overall Source Code for above Project
Note:
Hello Guys, Don't Stop Learning keep Going..............
Comments
Post a Comment