forked from jogrundy/Read_QuickDAQ_.hpf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgui.py
44 lines (37 loc) · 989 Bytes
/
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
import PySimpleGUI as sg
import os
import read_hpf
# Shoutout to Mr. Amith on youtube!
#
# https://www.youtube.com/watch?v=ykQ3LFiWhm8&t=606s
#
# Great video for getting a gui put together
working_directory = os.getcwd()
layout = [
[
sg.Text('choose a .hpf file')
],
[
sg.Text()
],
[
sg.InputText(key='-FILE_PATH-'),
sg.FileBrowse(initial_folder=working_directory, file_types=[("HPF Files", ".hpf")])
],
[
sg.Button('submit'),
sg.Exit()
]
]
window = sg.Window('hpf converter', layout)
def doStuff(hpf_address):
read_hpf.test_method(hpf_address)
read_hpf.write_info_and_csv_from_hpf(hpf_address)
while True:
event, value = window.read()
if event in (sg.WINDOW_CLOSED, 'Exit'):
break
elif event == 'submit':
hpf_address = value["-FILE_PATH-"]
doStuff(hpf_address)
window.close()