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,