User interface finished

This commit is contained in:
Fredrcik W. Warren 2024-05-26 17:45:50 -06:00
parent cc3a3dd07d
commit d0060ee9ee

View File

@ -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()