update image if title or subtitle changes

This commit is contained in:
Fredrick W. Warren 2022-05-30 10:09:19 -07:00
parent be6f17d2c9
commit f7a6571762

View File

@ -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,