From 864486d9d7249a6a8d4d6afe33ce04be8a17a82a Mon Sep 17 00:00:00 2001 From: "Fredrcik W. Warren" Date: Sun, 26 May 2024 16:58:18 -0600 Subject: [PATCH] added logo to program --- pismotek-remote.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pismotek-remote.py b/pismotek-remote.py index 6dc161d..8c8d486 100644 --- a/pismotek-remote.py +++ b/pismotek-remote.py @@ -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()