2018-10-04 23:42:25 +00:00
|
|
|
#!/usr/bin/env python
|
2019-10-23 20:10:03 +00:00
|
|
|
import PySimpleGUI as sg
|
2018-10-04 23:42:25 +00:00
|
|
|
|
2019-10-23 20:10:03 +00:00
|
|
|
# Simple example of TabGroup element
|
2018-10-04 23:42:25 +00:00
|
|
|
|
2019-10-23 20:10:03 +00:00
|
|
|
tab1_layout = [[sg.Text('Tab 1')],
|
|
|
|
[sg.Text('Put your layout in here')],
|
|
|
|
[sg.Text('Input something'), sg.Input(key='-IN0-')]]
|
2018-10-04 23:42:25 +00:00
|
|
|
|
2019-10-23 20:10:03 +00:00
|
|
|
tab2_layout = [[sg.Text('Tab2')]]
|
2018-10-04 23:42:25 +00:00
|
|
|
|
|
|
|
|
2019-10-23 20:10:03 +00:00
|
|
|
layout = [[sg.TabGroup([[
|
|
|
|
sg.Tab('Tab 1', tab1_layout),
|
|
|
|
sg.Tab('Tab 2', tab2_layout)]], key='-TABGROUP-')],
|
|
|
|
[sg.Button('Read')]]
|
|
|
|
|
|
|
|
window = sg.Window('My window with tabs', layout
|
|
|
|
default_element_size=(12, 1))
|
2018-10-04 23:42:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
while True:
|
2019-10-23 20:10:03 +00:00
|
|
|
event, values = window.read()
|
|
|
|
sg.popup_non_blocking('button = %s' % event, 'Values dictionary', values)
|
2018-10-15 20:07:23 +00:00
|
|
|
if event is None: # always, always give a way out!
|
2018-10-04 23:42:25 +00:00
|
|
|
break
|
2019-10-23 20:10:03 +00:00
|
|
|
|
|
|
|
window.close()
|