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 ----------- # ----------- Create the 3 layouts this Window will display -----------
layout1 = [ layout1 = [
[ [sg.Push(), sg.Image(logo), sg.Push()],
sg.Image(logo), [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?')],
sg.Text('This is layout 1'),
],
] ]
layout2 = [ layout2 = [
[sg.Text('This is layout 2')], [sg.Text('Remote connection started')],
[sg.Text('Click Exit when finished')],
] ]
layout3 = [ 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 # ----------- Create actual layout using Columns and a row of Buttons
@ -46,15 +46,12 @@ layout = [
sg.Column(layout2, visible=False, key='-COL2-'), sg.Column(layout2, visible=False, key='-COL2-'),
sg.Column(layout3, visible=False, key='-COL3-') sg.Column(layout3, visible=False, key='-COL3-')
], ],
[ [sg.VPush()],
sg.Button('1'), [sg.Push(), sg.Button('No'), sg.Button('Yes'), sg.Button('Exit', visible=False)]
sg.Button('2'),
sg.Button('3'),
sg.Button('Exit')
]
] ]
window = sg.Window('Swapping the contents of a window', layout) window = sg.Window('Pismotek', layout, size=(380, 350))
layout = 1 # The currently visible layout layout = 1 # The currently visible layout
@ -63,9 +60,19 @@ while True:
print(event, values) print(event, values)
if event in (sg.WIN_CLOSED, 'Exit'): if event in (sg.WIN_CLOSED, 'Exit'):
break break
elif event in '123': elif event == 'Yes':
window[f'-COL{layout}-'].update(visible=False) window['-COL1-'].update(visible=False)
layout = int(event) layout = int(2)
window[f'-COL{layout}-'].update(visible=True) 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() window.close()