GUI to Shutdown, Restart and Logout from the PC using Python
In this article, we are going to write a python script to shut down or Restart or Logout your system and bind it with GUI Application.
The OS module in Python provides functions for interacting with the operating system. OS is an inbuilt library python.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
For shutdown your system : os.system(“shutdown /s /t 1”)
For restart your system : os.system(“shutdown /r /t 1”)
For Logout your system : os.system(“shutdown -l”)
Implementation GUI Application using Tkinter:
Note: Please ensure that you save and close all the programs before running this code on the IDLE, as this program will immediately shutdown and restart your computer.