mirror of
https://github.com/Shawn-Shan/fawkes.git
synced 2024-11-09 13:41:31 +05:30
81a6fed188
Former-commit-id: e7e46967035dfb727d180de0a0780ca9e026dd02 [formerly 0e703ac63e52aafbaa3033759553e2f3b31d2886] Former-commit-id: 9dfff8ea4c2646d90203b378e0732330e655086a
63 lines
1.6 KiB
Python
63 lines
1.6 KiB
Python
import threading
|
|
|
|
import fawkes.protection
|
|
|
|
from tkinter import Tk, BOTH, StringVar
|
|
from tkinter.ttk import Frame, Label, Style, Button
|
|
from tkinter.filedialog import askdirectory, askopenfilenames
|
|
|
|
|
|
class UI(Frame):
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.my_fawkes = fawkes.protection.Fawkes("high_extract", '0', 1)
|
|
self.var = StringVar()
|
|
self.var.set('Initial')
|
|
self.img_paths = './imgs'
|
|
self.initUI()
|
|
|
|
def initUI(self):
|
|
self.master.title("This is a Window")
|
|
self.pack(fill=BOTH, expand=1)
|
|
|
|
btn_Open = Button(self,
|
|
text='open img directory',
|
|
width=30,
|
|
command=self.select_path)
|
|
btn_Open.pack()
|
|
|
|
btn_Run = Button(self,
|
|
text='run the code',
|
|
width=3,
|
|
command=lambda: thread_it(self.my_fawkes.run_protection, self.img_paths))
|
|
btn_Run.pack()
|
|
|
|
Label_Show = Label(self,
|
|
textvariable=self.var,
|
|
font=('Arial', 13), width=50)
|
|
Label_Show.pack()
|
|
|
|
def select_path(self):
|
|
self.img_paths = askopenfilenames(filetypes=[('image', "*.gif *.jpg *.png")])
|
|
self.var.set('the paths have been set')
|
|
|
|
|
|
root = Tk()
|
|
root.title('window')
|
|
root.geometry('600x500')
|
|
app = UI()
|
|
|
|
|
|
def main():
|
|
root.mainloop()
|
|
|
|
|
|
def thread_it(func, *args):
|
|
app.var.set('cloak in process')
|
|
t = threading.Thread(target=func, args=args)
|
|
t.setDaemon(True)
|
|
t.start()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main() |