61 lines
2.4 KiB
Python
61 lines
2.4 KiB
Python
from funkcje.obraz import Obraz
|
|
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, 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("OBRAZ"), sg.Button('HELP'), sg.Button("AKCJA")] ]
|
|
# ZADANIE:
|
|
# dodaj przycisk o nazwie SYSTEM, wtedy na ekranie ma być
|
|
# print(sys.version)
|
|
# pamiętaj o imporcie sys ....
|
|
|
|
# Create the Window
|
|
window = sg.Window('Nasz super program', layout)
|
|
# Event Loop to process "events" and get the "values" of the inputs
|
|
while True:
|
|
event, values = window.read()
|
|
if event == sg.WIN_CLOSED or event == 'Przerwij': # if user closes window or clicks cancel
|
|
break
|
|
if event == 'HELP':
|
|
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 =="OBRAZ":
|
|
pliczek = values['input']
|
|
if pliczek:
|
|
if pliczek[-3:] == 'png':
|
|
obrazek = Obraz(pliczek)
|
|
if obrazek.load_image():
|
|
obrazek.show_image()
|
|
obrazek.transform_smoothing()
|
|
obrazek.show_image_other()
|
|
|
|
|
|
if event == "Ok":
|
|
sg.easy_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() |