diff --git a/dzien_05/gui/gui02.py b/dzien_05/gui/gui02.py index bad22c7..fc5d29c 100644 --- a/dzien_05/gui/gui02.py +++ b/dzien_05/gui/gui02.py @@ -3,11 +3,11 @@ import FreeSimpleGUI as sg # sg.theme('DarkAmber') # Add a touch of color # All the stuff inside your window. layout = [ [sg.Text('Wybrana data'), sg.In(key='data') ,sg.CalendarButton("Data", target='data')], - [sg.Radio("Wybór A", "R01", default=True), sg.Radio("Wybór B", "R01")], - [sg.Text('Enter something on Row 2'), sg.InputText()], - [sg.Text('Enter something on Row XX'), sg.InputText()], + [sg.Radio("Wybór A", "R01", default=True, key='A'), sg.Radio("Wybór B", "R01", key="B")], + [sg.Text('Enter something on Row 2'), sg.InputText(key="row2")], + [sg.Text('Enter something on Row XX'), sg.InputText(key="inna")], [sg.Text('Wybrany plik'), sg.In(key='input'), sg.FileBrowse(target='input')], - [sg.Button('Ok'), sg.Button('Przerwij'), sg.Button('HELP')] ] + [sg.Button('Ok'), sg.Button('Przerwij'), sg.Button('HELP'), sg.Button("AKCJA")] ] # ZADANIE: # dodaj przycisk o nazwie SYSTEM, wtedy na ekranie ma być # print(sys.version) @@ -24,10 +24,26 @@ while True: print("Pomoc dla ludu!!!") plik = sg.popup_get_file('Please enter a file name') sg.popup('Results', 'The value from PopupGetText', plik) + + if event =="AKCJA": + pliczek = values['input'] + if pliczek: + if pliczek[-3:] == 'csv': + with open(pliczek, 'r', encoding="UTF-8") as plik_odczyt: + dane = plik_odczyt.read() + sg.easy_print(dane) if event == "Ok": - print('You entered ', values[2], values[3]) + sg.easy_print(f"{values=}") - print(f"{values=}") + + # values={ + # 'data': '2025-12-18 12:21:48', + # 'Data': '', + # 0: False, 1: True, + # 2: 'dsaasf', 3: 'dddddddddddddd', + # 'input': '/home/adasiek/Nextcloud/05_SZKOLENIA/10_COMARCH/20251215_Python_Nieprogramisci/2025_12_15_python/arkusz.xlsx', + # 'Browse': '/home/adasiek/Nextcloud/05_SZKOLENIA/10_COMARCH/20251215_Python_Nieprogramisci/2025_12_15_python/arkusz.xlsx' + # } window.close() \ No newline at end of file