-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay2(shutdownapp).py
35 lines (26 loc) · 1.24 KB
/
Day2(shutdownapp).py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#shutdown app using python
import tkinter as tk #we can also write from tkinter import * ( which imports all function of tkinter)
import os
#functions for buttons
def restart():
os.system("shutdown /r /t 1") #1 is time
def restart_time():
os.system("shutdown /r /t 20")
def logout():
os.system("shutdown -l")
def shutdown():
os.system("shutdown /s /t 1")
# calling of Tk liabrary
st=tk.Tk()
st.title("Shutdown app")
st.geometry("300x300")
st.config(bg="Blue")
r_button =tk.Button(st,text="Restart",font=("Time New Roman",10,"bold"),cursor="hand2",command=restart) #font(font,size,style)
r_button.place(x=50,y=50,height=40,width=200)
r_button =tk.Button(st,text="Restart Time",font=("Time New Roman",10,"bold"),cursor="hand2",command=restart_time) #font(font,size,style)
r_button.place(x=50,y=100,height=40,width=200) #(outer,inner)
r_button = tk.Button(st,text="Log-Out",font=("Time New Roman",10,"bold"),cursor="hand2",command=logout) #font(font,size,style)
r_button.place(x=50,y=150,height=40,width=200)
r_button = tk.Button(st,text="ShutDown",font=("Time New Roman",10,"bold"),cursor="hand2",command=shutdown) #font(font,size,style)
r_button.place(x=50,y=200,height=40,width=200)
st.mainloop()