refactor image processing out of layout

This commit is contained in:
Fredrick W. Warren 2022-05-29 18:33:32 -07:00
parent b896476cd2
commit a462f169e4

View File

@ -28,9 +28,7 @@ def update_thumbnail(image):
return thumbnail
def build_layout(image_path):
title = 'Pastor Shane Wallis'
subtitle = 'Bible Stduy Wednesday June 1st, 2022'
def build_layout(title, subtitle, thumbnail):
control_col = sg.Column([
[
sg.Frame('Title',
@ -43,9 +41,7 @@ def build_layout(image_path):
[
sg.Button('Save image', key= '-SAVE-')],
])
original = Image.open(image_path)
image = update_image(original, title, subtitle)
thumbnail = update_thumbnail(image)
bio = BytesIO()
thumbnail.save(bio, format = 'PNG')
image_col = sg.Column([[sg.Image(data=bio.getvalue(), key = '-IMAGE-')]])
@ -53,9 +49,14 @@ def build_layout(image_path):
return layout
def main():
title = 'Pastor Shane Wallis'
subtitle = 'Bible Stduy Wednesday June 1st, 2022'
image_path = 'blank_title.png'
original = Image.open(image_path)
layout = build_layout(image_path)
image = update_image(original, title, subtitle)
thumbnail = update_thumbnail(image)
layout = build_layout(title, subtitle, thumbnail)
window = sg.Window('Harvest Christian Assembly Message Title', layout)
while True: