2018-11-13 15:33:55 +00:00
|
|
|
#PySimple examples (v 3.9)
|
2018-10-08 05:36:38 +00:00
|
|
|
#Tony Crewe
|
2018-11-13 15:33:55 +00:00
|
|
|
#Sep 2018 MacOs
|
2018-10-08 05:36:38 +00:00
|
|
|
|
|
|
|
import PySimpleGUI as sg
|
|
|
|
|
2018-11-13 15:33:55 +00:00
|
|
|
#sg.ChangeLookAndFeel('SandyBeach')
|
|
|
|
sg.SetOptions (background_color = 'LightBlue',
|
|
|
|
element_background_color = 'LightBlue',
|
|
|
|
text_element_background_color = 'LightBlue',
|
|
|
|
font = ('Arial', 14, 'bold'),
|
|
|
|
text_color = 'Blue',
|
|
|
|
input_text_color ='Blue',
|
|
|
|
button_color = ('Blue', 'White')
|
|
|
|
)
|
2018-10-08 05:36:38 +00:00
|
|
|
|
|
|
|
layout0 = [[sg.ReadButton('Show/Hide window1'),sg.ReadButton('Show/Hide window2')]]
|
|
|
|
|
|
|
|
layout1 =[[ sg.Text('window1')], [sg.Multiline( size = (35, 10))]]
|
|
|
|
layout2 =[[ sg.Text('window2')], [sg.Multiline( size = (35, 10))]]
|
2018-11-13 15:33:55 +00:00
|
|
|
window0 = sg.Window('Home Window', location = (200, 140)).Layout(layout0)
|
2018-10-08 05:36:38 +00:00
|
|
|
|
2018-11-13 15:33:55 +00:00
|
|
|
window1 = sg.Window('Window1', location = (200, 200)).Layout(layout1).Finalize()
|
2018-10-08 05:36:38 +00:00
|
|
|
window1.Hide()
|
|
|
|
w1 = False
|
|
|
|
|
2018-11-13 15:33:55 +00:00
|
|
|
window2 = sg.Window('Window2', location = (600, 200)).Layout(layout2).Finalize()
|
2018-10-08 05:36:38 +00:00
|
|
|
window2.Hide()
|
|
|
|
w2 = False
|
|
|
|
|
|
|
|
while True:
|
|
|
|
button, v = window0.Read()
|
|
|
|
if button is not None:
|
|
|
|
if button =='Show/Hide window1':
|
|
|
|
if w1 == True:
|
|
|
|
window1.Hide()
|
|
|
|
w1 = False
|
|
|
|
else:
|
|
|
|
window1.UnHide()
|
|
|
|
w1=True
|
|
|
|
if button =='Show/Hide window2':
|
|
|
|
if w2 == True:
|
|
|
|
window2.Hide()
|
|
|
|
w2 = False
|
|
|
|
else:
|
|
|
|
window2.UnHide()
|
|
|
|
w2=True
|
|
|
|
else:
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
|