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-27 20:24:09 +00:00
|
|
|
|
2018-09-25 05:33:32 +00:00
|
|
|
sg.ChangeLookAndFeel('GreenTan')
|
|
|
|
tab2_layout = [[sg.T('This is inside tab 2')],
|
2018-09-27 20:24:09 +00:00
|
|
|
[sg.T('Tabs can be anywhere now!')]]
|
2018-09-24 22:01:00 +00:00
|
|
|
|
2018-09-25 05:33:32 +00:00
|
|
|
tab1_layout = [[sg.T('Type something here and click button'), sg.In(key='in')]]
|
2018-09-24 22:01:00 +00:00
|
|
|
|
|
|
|
tab3_layout = [[sg.T('This is inside tab 3')]]
|
|
|
|
tab4_layout = [[sg.T('This is inside tab 4')]]
|
|
|
|
|
2018-09-25 05:33:32 +00:00
|
|
|
tab_layout = [[sg.T('This is inside of a tab')]]
|
|
|
|
tab_group = sg.TabGroup([[sg.Tab('Tab 7', tab_layout), sg.Tab('Tab 8', tab_layout)]])
|
|
|
|
|
|
|
|
tab5_layout = [[sg.T('Watch this window')],
|
|
|
|
[sg.Output(size=(40,5))]]
|
2018-09-24 22:01:00 +00:00
|
|
|
tab6_layout = [[sg.T('This is inside tab 6')],
|
2018-09-25 05:33:32 +00:00
|
|
|
[sg.T('How about a second row of stuff in tab 6?'), tab_group]]
|
2018-09-24 22:01:00 +00:00
|
|
|
|
|
|
|
layout = [[sg.T('My Window!')], [sg.Frame('A Frame', layout=
|
2018-09-25 05:33:32 +00:00
|
|
|
[[sg.TabGroup([[sg.Tab('Tab 1', tab1_layout), sg.Tab('Tab 2', tab2_layout)]]), sg.TabGroup([[sg.Tab('Tab3', tab3_layout), sg.Tab('Tab 4', tab4_layout)]])]])],
|
2018-09-24 22:01:00 +00:00
|
|
|
[sg.T('This text is on a row with a column'),sg.Column(layout=[[sg.T('In a column')],
|
|
|
|
[sg.TabGroup([[sg.Tab('Tab 5', tab5_layout), sg.Tab('Tab 6', tab6_layout)]])],
|
2018-09-27 20:24:09 +00:00
|
|
|
[sg.RButton('Click me')]])],]
|
2018-09-24 22:01:00 +00:00
|
|
|
|
2018-09-25 05:33:32 +00:00
|
|
|
window = sg.Window('My window with tabs', default_element_size=(12,1)).Layout(layout).Finalize()
|
|
|
|
|
|
|
|
print('Are there enough tabs for you?')
|
2018-09-24 22:01:00 +00:00
|
|
|
|
|
|
|
while True:
|
2018-10-15 20:07:23 +00:00
|
|
|
event, values = window.Read()
|
|
|
|
print(event, values)
|
|
|
|
if event is None: # always, always give a way out!
|
2018-09-24 22:01:00 +00:00
|
|
|
break
|