added logo to program

This commit is contained in:
Fredrcik W. Warren 2024-05-26 16:58:18 -06:00
parent 14d33a24b3
commit 864486d9d7

View File

@ -1,5 +1,6 @@
#!/bin/env python
import os
import PySimpleGUI as sg
"""
@ -9,9 +10,25 @@ import PySimpleGUI as sg
on the same row and make only 1 of them active at a time
"""
def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
try:
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
logo = resource_path("Logo.png")
# ----------- Create the 3 layouts this Window will display -----------
layout1 = [
[sg.Text('This is layout 1')],
[
sg.Image(logo),
],
[
sg.Text('This is layout 1'),
],
]
layout2 = [
@ -39,6 +56,7 @@ layout = [
window = sg.Window('Swapping the contents of a window', layout)
layout = 1 # The currently visible layout
while True:
event, values = window.read()