-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
32 lines (25 loc) · 1003 Bytes
/
main.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
import PySimpleGUI as sg
from zip_extractor import extract_archive
sg.theme('DarkAmber')
label1 = sg.Text("Select archive")
input1 = sg.Input()
choose_button = sg.FileBrowse("Choose", key="archive")
label2 = sg.Text("Select destination")
input2 = sg.Input()
choose_button2 = sg.FolderBrowse("Choose", key="folder")
extract_button = sg.Button("Extract")
output_label = sg.Text(key="output", text_color="green")
window = sg.Window("Archive Extractor", layout =[[label1, input1, choose_button],
[label2,input2,choose_button2],
[extract_button, output_label]])
while True:
try:
event, values = window.read()
archivepath = values["archive"]
dest_dir = values["folder"]
extract_archive(archivepath, dest_dir)
window["output"].update(value = f"Successfully extracted to {dest_dir}")
except (AttributeError,TypeError) :
sg.WINDOW_CLOSED
break
window.close()