-
Notifications
You must be signed in to change notification settings - Fork 0
/
actualizar_config.py
36 lines (31 loc) · 1.03 KB
/
actualizar_config.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
from configparser import ConfigParser
from tkinter.filedialog import askdirectory
from win10toast import ToastNotifier
toast = ToastNotifier()
file = 'config.ini'
config = ConfigParser()
config.read(file)
#ruta vieja C:/Users/miyav/videos/prueba-wdog
# path = askdirectory()
path = '{}'.format(askdirectory(title='Seleccionar carpeta',initialdir=r'C:/Users/miyav/Videos'))
if path == '':
toast.show_toast(
"Operación cancelada",
"El folder a editar NO se modificó\n\nEl folder actual es:\n"+config['Borrar']['ubicacion'], #imprime dirección del folder
duration = 7,
icon_path = "python.ico",
threaded = True,
)
else:
# config.add_section('masnueva') #
config.set('Borrar', 'ubicacion', path)
print(path)
with open(file, 'w') as config_file:
config.write(config_file)
toast.show_toast(
"Ubicación modificada",
"Se ha cambiado el folder que será modificado\n\n"+path, #imprime dirección del folder
duration = 7,
icon_path = "python.ico",
threaded = True,
)