From f7a65717622004175682497721b2095d9b7023ca Mon Sep 17 00:00:00 2001 From: "Fredrick W. Warren" Date: Mon, 30 May 2022 10:09:19 -0700 Subject: [PATCH] update image if title or subtitle changes --- hcatitles.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hcatitles.py b/hcatitles.py index 996f720..1acee09 100644 --- a/hcatitles.py +++ b/hcatitles.py @@ -64,11 +64,24 @@ def main(): layout = build_layout(title, subtitle, thumbnail) window = sg.Window('Harvest Christian Assembly Message Title', layout) + # image contains the final image while True: event, values = window.read(timeout=50) if event == sg.WIN_CLOSED: break + if event == "-TITLE-" or event == '-SUBTITLE-': + if values['-TITLE-'] != title or values['-SUBTITLE-'] != subtitle: + title = values['-TITLE-'] + subtitle = values['-SUBTITLE-'] + original = Image.open(image_path) + image = update_image(original, title, subtitle) + thumbnail = update_thumbnail(image) + bio = BytesIO() + thumbnail.save(bio, format = 'PNG') + window['-IMAGE-'].update(data = bio.getvalue()) + + if event == "-SAVE-": save_path = sg.popup_get_file('Save', save_as = True,