-
Notifications
You must be signed in to change notification settings - Fork 0
/
GUI.py
127 lines (109 loc) · 3.59 KB
/
GUI.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import tkinter as tk
from tkinter import filedialog
from Modules.VirusAPI import scan
from OptionBox import option_box
from os import remove
filePath = ''
func_selected = ''
def option_selector():
from Modules.Encryptor import encrypt
from Modules.Encryptor import decrypt
global func_selected
func_selected = option_box(msg='Do you want to encrypt or decrypt the file?',
b1=('encrypt', encrypt),
b2=('decrypt', decrypt),
frame=False,
entry=False,
t=False)
clear_entry_box()
if filePath != '':
func_selected(file_path=filePath)
else:
func_selected()
# File Browse Function
def browse_function():
global filePath
filePath = filedialog.askopenfilename()
try:
enter_path.insert(tk.END, filePath)
print(filePath)
except NameError:
pass
# Scan Function
def scan_call():
scan(filePath)
clear_entry_box()
# Delete Function
def delete_call():
remove(filePath)
print(f'Successfully deleted {filePath}')
# Clear entry box
def clear_entry_box():
sentence = enter_path.get()
enter_path.delete(0, len(sentence))
window = tk.Tk()
# Background of window
window.configure(background='#161b22')
window.geometry("860x140")
# Title of the window
window.title('VFree Antivirus')
# Enter file path label
Label1 = tk.Label(window,
justify=tk.LEFT,
fg='#58a6ff',
bg='#161b22',
padx=15,
text='Select File to Scan:',
font="Helvetica 16 bold").grid(row=1, column=1)
# Path Entry Box
enter_path = tk.Entry(window,
font=40,
highlightbackground='#161b22',
highlightcolor='#161b22',
highlightthickness=5,
relief=tk.FLAT,
width=50)
enter_path.grid(row=1, column=2)
# Path entry button
button1 = tk.Button(window,
text="Open",
font="Helvetica 13 bold",
command=browse_function,
background='#21262d',
foreground='white',
activeforeground='white',
activebackground='#32373e')
button1.grid(row=1, column=3)
# Scan Button
button2 = tk.Button(window,
text="Scan",
font="Helvetica 13 bold",
command=scan_call,
background='#21262d',
foreground='white',
activeforeground='white',
activebackground='#32373e',
width=40)
button2.place(rely='0.35', relx='0.02')
# Encrypt Button
button3 = tk.Button(window,
text="Encrypt / Decrypt",
font="Helvetica 13 bold",
command=option_selector,
background='#21262d',
foreground='white',
activeforeground='white',
activebackground='#32373e',
width=40)
button3.place(rely='0.35', relx='0.51')
button4 = tk.Button(window,
text="Delete",
font="Helvetica 13 bold",
command=delete_call,
background='#21262d',
foreground='white',
activeforeground='white',
activebackground='#32373e',
width=40)
button4.place(rely='0.7', relx='0.25')
window.mainloop()