2018-09-27 20:24:09 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
import sys
|
2018-09-28 18:57:37 +00:00
|
|
|
if sys.version_info[0] >= 3:
|
2018-09-27 20:24:09 +00:00
|
|
|
import PySimpleGUI as sg
|
2018-09-28 18:57:37 +00:00
|
|
|
else:
|
|
|
|
import PySimpleGUI27 as sg
|
2018-09-24 14:40:08 +00:00
|
|
|
|
2018-09-25 05:33:32 +00:00
|
|
|
tab1_layout = [[sg.T('This is inside tab 1')]]
|
2018-09-24 14:40:08 +00:00
|
|
|
|
2018-09-25 05:33:32 +00:00
|
|
|
tab2_layout = [[sg.T('This is inside tab 2')],
|
2018-10-03 18:00:44 +00:00
|
|
|
[sg.In(key='_in2_')]]
|
2018-09-24 14:40:08 +00:00
|
|
|
|
2018-10-03 18:00:44 +00:00
|
|
|
tab3_layout = [[sg.T('This is inside tab 3')],
|
|
|
|
[sg.In(key='_in3_')]]
|
|
|
|
|
|
|
|
tab4_layout = [[sg.T('This is inside tab 4')],
|
|
|
|
[sg.In(key='_in4_')]]
|
|
|
|
|
|
|
|
|
|
|
|
layout = [[sg.TabGroup([[sg.Tab('Tab 1', tab1_layout, key='_mykey_'), sg.Tab('Tab 2', tab2_layout)]], key='_group2_', background_color='green', tab_location='top')],
|
|
|
|
[sg.TabGroup([[sg.Tab('Tab 3', tab3_layout, key='_mykey_'), sg.Tab('Tab 4', tab4_layout)]], key='_group1_', tab_location='right')],
|
2018-09-25 05:33:32 +00:00
|
|
|
[sg.RButton('Read')]]
|
2018-09-24 14:40:08 +00:00
|
|
|
|
2018-09-24 22:01:00 +00:00
|
|
|
window = sg.Window('My window with tabs', default_element_size=(12,1)).Layout(layout)
|
2018-09-24 14:40:08 +00:00
|
|
|
|
2018-09-24 14:53:24 +00:00
|
|
|
while True:
|
|
|
|
b, v = window.Read()
|
|
|
|
print(b,v)
|
|
|
|
if b is None: # always, always give a way out!
|
|
|
|
break
|