From d0060ee9eebd73e004428e8ef3a29e2bd5bb824f Mon Sep 17 00:00:00 2001 From: "Fredrcik W. Warren" Date: Sun, 26 May 2024 17:45:50 -0600 Subject: [PATCH] User interface finished --- pismotek-remote.py | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/pismotek-remote.py b/pismotek-remote.py index df83f2b..9f1f59f 100644 --- a/pismotek-remote.py +++ b/pismotek-remote.py @@ -23,20 +23,20 @@ logo = resource_path("logo.png") # ----------- Create the 3 layouts this Window will display ----------- layout1 = [ - [ - sg.Image(logo), - ], - [ - sg.Text('This is layout 1'), - ], + [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('This is layout 2')], + [sg.Text('Remote connection started')], + [sg.Text('Click Exit when finished')], ] layout3 = [ - [sg.Text('This is layout 3')], + [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 @@ -46,15 +46,12 @@ layout = [ sg.Column(layout2, visible=False, key='-COL2-'), sg.Column(layout3, visible=False, key='-COL3-') ], - [ - sg.Button('1'), - sg.Button('2'), - sg.Button('3'), - sg.Button('Exit') - ] + [sg.VPush()], + [sg.Push(), sg.Button('No'), sg.Button('Yes'), sg.Button('Exit', visible=False)] + ] -window = sg.Window('Swapping the contents of a window', layout) +window = sg.Window('Pismotek', layout, size=(380, 350)) layout = 1 # The currently visible layout @@ -63,9 +60,19 @@ while True: print(event, values) if event in (sg.WIN_CLOSED, 'Exit'): break - elif event in '123': - window[f'-COL{layout}-'].update(visible=False) - layout = int(event) - window[f'-COL{layout}-'].update(visible=True) + 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()