#!/bin/env python import os import PySimpleGUI as sg """ Pismotek-Remote - Remote Desktop Application To "swap out" a portion of a window, use a Column element for that portion. Add multiple Columns 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.Push(), sg.Image(logo), sg.Push()], [sg.Text('This program allows Will B. to remotely control your')], [sg.Text('computer through the internet')], [sg.Text('Is Will waiting for you - *right now* - to run this program?')], ] layout2 = [ [sg.Text('Remote connection started')], [sg.Text('Click Exit when finished')], ] layout3 = [ [sg.Text('Please run this program ONLY when Will is waiting for you')], [sg.Text('Click Exit to continue')], ] # ----------- Create actual layout using Columns and a row of Buttons layout = [ [ sg.Column(layout1, key='-COL1-'), sg.Column(layout2, visible=False, key='-COL2-'), sg.Column(layout3, visible=False, key='-COL3-') ], [sg.VPush()], [sg.Push(), sg.Button('No'), sg.Button('Yes'), sg.Button('Exit', visible=False)] ] window = sg.Window('Pismotek', layout, size=(380, 350)) layout = 1 # The currently visible layout while True: event, values = window.read() print(event, values) if event in (sg.WIN_CLOSED, 'Exit'): break elif event == 'Yes': window['-COL1-'].update(visible=False) layout = int(2) window['-COL2-'].update(visible=True) window['No'].update(visible=False) window['Yes'].update(visible=False) window['Exit'].update(visible=True) elif event == 'No': window['-COL1-'].update(visible=False) layout = int(3) window['-COL3-'].update(visible=True) window['No'].update(visible=False) window['Yes'].update(visible=False) window['Exit'].update(visible=True) window.close()