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