-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgui.py
82 lines (81 loc) · 2.31 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
from PySimpleGUI.PySimpleGUI import Window
import PySimpleGUI as sg
import main
# sg.theme("TealMono")
app_name = "Excel Comparer"
layout = [
[
sg.Column(
[
[
sg.Text(
app_name,
font=("Helvetica, 24"),
justification="c",
)
],
],
element_justification="c",
justification="c",
)
],
[
sg.Text("Select Workbook 1"),
sg.Input(),
sg.FileBrowse("Select", key="--WB1--", file_types=(("Excel Workbook", "*.xlsx"),)),
],
[
sg.T("Sheet"),
sg.InputText("Sheet1", key="--ws1--", size=(15, 1)),
sg.T("Columns (in order)"),
sg.InputText("A,B", key="--cols1--", size=(20, 1)),
],
[sg.T("")],
[sg.HorizontalSeparator()],
[sg.T("")],
[
sg.Text("Select Workbook 2"),
sg.Input(),
sg.FileBrowse("Select", key="--WB2--", file_types=(("Excel Workbook", "*.xlsx"),)),
],
[
sg.T("Sheet"),
sg.InputText("Sheet1", key="--ws2--", size=(15, 1)),
sg.T("Columns (in order)"),
sg.InputText("A,B", key="--cols2--", size=(20, 1)),
],
[sg.T("")],
[sg.HorizontalSeparator()],
[sg.T("")],
[
sg.Button(" Start ", key="--START--"),
sg.CBox(" Ignore case ", key="--case--")
],
]
font = "Arial, 12"
window = sg.Window(
app_name, layout, resizable=True, font=font, margins=(10, 10), finalize=True
)
window.finalize()
while True:
event, values = window.read()
if (
event == sg.WIN_CLOSED or event == "Cancel"
): # if user closes window or clicks cancel
break
elif event == "--START--":
wb1 = values.get("--WB1--", None)
wb2 = values.get("--WB2--", None)
if not wb1 or not wb2:
print("Please select a valid file")
continue
ws1 = values.get("--ws1--", None)
ws2 = values.get("--ws2--", None)
cols1 = values.get("--cols1--", None)
cols2 = values.get("--cols2--", None)
case = values.get("--case--", None)
try:
main.main(wb1, wb2, ws1, ws2, cols1, cols2, case)
except Exception as e:
print("Something went wrong:", str(e))
window.close()