-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.pyw
executable file
·47 lines (32 loc) · 1.37 KB
/
app.pyw
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
import os, shelve, shutil
import PySimpleGUI as sg
class star_load:
def __init__(self):
self.data_arq = shelve.open('path_')
choices = list(self.data_arq.keys())
sg.theme('DarkBlue14')
layout = [ [sg.Text('Filename')],
[sg.Input(key='-IN-'), sg.FileBrowse()],
[sg.Save(), sg.Cancel()],
[sg.Text('Listas de arqs')],
[sg.Listbox(choices, size=(50,10, len(choices)), key='-OUTPUT-')],
[sg.Button('Excluir')] ]
self.windows = sg.Window('Start Load', layout)
def Iniciar(self):
while True:
events, values = self.windows.read()
if events == sg.WIN_CLOSED:
break
elif events == 'Save':
path_arq =str(values['Browse']).replace('/','\\')
self.data_arq[os.path.basename(path_arq)] = path_arq
self.windows['-OUTPUT-'].update(self.data_arq)
elif events == 'Excluir':
#print(self.datavalues['-OUTPUT-'][0])
del self.data_arq[values['-OUTPUT-'][0]]
self.windows['-OUTPUT-'].update(self.data_arq)
elif events == None:
sg.popup('Não selecionou o arquivo')
self.windows.close()
start = star_load()
start.Iniciar()