-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.py
54 lines (51 loc) · 2.03 KB
/
update.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/python3
# Black-wikipedia v1.0
import os,subprocess,platform
try:
from tkinter import *
from tkinter.ttk import *
from tkinter.messagebox import showerror
except ImportError:
subprocess.getoutput("pip update tk-tools")
class black_wikipedia(Tk):
def __init__(self):
super(black_wikipedia,self).__init__()
self.title('Black Wikipedia')
label_l = Label(self,text='Black-wikipedia',background='white',foreground='black',font=("None",15))
label_l.place(bordermode=INSIDE,x=120,y=20)
self.update_b = Button(self,text='update',command=self.update)
self.update_b.place(bordermode=OUTSIDE,x=160,y=110)
self.exit_b = Button(self,text='Exit',command=self.ext)
self.exit_b.place(bordermode=OUTSIDE,x=160,y=135)
self.config(background='white')
self.resizable(False,False)
self.geometry("400x300")
self.photo = PhotoImage(file = './Scr/black.png')
self.iconphoto(False,self.photo)
self.mainloop()
def update(self):
global pr
pr = Progressbar(self,orient='horizontal',mode='determinate',length=200)
pr.place(bordermode=INSIDE,x=105,y=65)
pr.start(55)
pr.after(6000,self.update_2)
def update_2(self):
subprocess.getoutput("cd .. && rm -r Black-wikipedia && git clone https://github.com/black-woftware-company/Black-wikipedia")
pr.stop()
pr.destroy()
label_mess = Label(self,text='Complete!',foreground='black',background='white')
label_mess.place(bordermode=INSIDE,x=170,y=65)
self.update_b.destroy()
self.exit_b.place(bordermode=OUTSIDE,x=160,y=110)
def ext(self):
self.destroy()
self.quit()
quit()
if __name__ == '__main__':
if platform.system() == 'Linux':
if os.getuid() == 0:
window = black_wikipedia()
else:
showerror(title='Cannot Running',message='Please, Check Root!')
else:
window = black_wikipedia()