refactor image processing out of layout
This commit is contained in:
parent
b896476cd2
commit
a462f169e4
15
hcatitles.py
15
hcatitles.py
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user